Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Drawsi |
I don’t get what’s happening, the code says its "Error change_scene(path: String)
-
extends KinematicBody2D
var velocity = Vector2(0,0) const speed = 80 const gravity = 3 const
jump_force = -80func _physics_process(delta): if
Input.is_action_pressed(“ui_right”): velocity.x = speed
$AnimatedSprite.play(“Run”) $AnimatedSprite.flip_h = falseelif Input.is_action_pressed(“ui_left”): velocity.x = -speed
$AnimatedSprite.play(“Run”) $AnimatedSprite.flip_h = trueelse: $AnimatedSprite.play(“Idle”) velocity.x = 0 if not
is_on_floor(): $AnimatedSprite.play(“Jump”) velocity.y =
velocity.y + gravity if Input.is_action_just_pressed(“ui_up”) and
is_on_floor() || Input.is_action_just_pressed(“ui_up”) and
is_on_wall(): velocity.y = jump_force velocity =
move_and_slide(velocity,Vector2.UP) velocity.x =
lerp(velocity.x,0,0.2)func _on_fallzone_body_entered(body):
get_tree().change_scene(“res://Level1.tscn”)