Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | azOZ0957 |
This is my script
export (int) var speed = 1200
export (int) var jump_speed = -1800
export (int) var gravity = 4000
var velocity = Vector2.ZERO
func get_input():
velocity.x = 0
if Input.is_action_pressed(“walk_right”):
velocity.x += speed
$AnimatedSprite.play(“run”)
else: $AnimatedSprite.stop()
if Input.is_action_pressed("walk_left"):
velocity.x -= speed
func _physics_process(delta):
get_input()
velocity.y += gravity * delta
velocity = move_and_slide(velocity, Vector2.UP)
if Input.is_action_just_pressed(“jump”):
if is_on_floor():
velocity.y = jump_speed
I Cant seem to get the animation script working it always says
Attempt to call function ‘stop’ in base ‘null instance’ on a null instance