0

There is this error on my gdscript code for CharacterBody2D that is supposed to jump and fall. The error says this: Line 13:Unexpected "Identifier" in class body.

`extends CharacterBody2D

@export var jump_impulse = 20

func _physics_process(delta): #...

# Jumping.
if is_on_floor() and Input.is_action_just_pressed("jump"):
    target_velocity.y = jump_impulse

#...

move_and_slide()`

according to the official docs of godot 4 its supposed to jump.

Fluzzy
  • 1
  • I'm guessing it is an indentation issue. – Theraot Jul 07 '23 at 18:23
  • which line is 13? Also, you have not supplied all code, but `target_velocity` is not defined. Move_and_slide() expect `velocity` to be set. Check that `target_velocity` is defined as var before using it, and copied into `velocity` before the move_and_slide. – Bgie Jul 07 '23 at 21:36

0 Answers0