Pulse Works Studio

Parse Error: Identifier "KinematicBody2D" not declared in the current scope. Did you mean to use "CharacterBody2D"?

Godot 4 renamed KinematicBody2D to CharacterBody2D. The old name is not a class.

Cause

Godot 4 removed the KinematicBody2D type. With the editor's Godot 4 rename hints on, the parser names the replacement. Movement is no longer a slide method that returns a velocity; you set velocity yourself and call move_and_slide().

Fix

extends CharacterBody2D

func _physics_process(delta: float) -> void:
	var direction := Input.get_axis("ui_left", "ui_right")
	velocity.x = direction * 220.0
	if not is_on_floor():
		velocity.y += 980.0 * delta
	move_and_slide()

Related

Godot Dev Tools is a Pulse Works Studio project. All error explainers.