cooking
This commit is contained in:
parent
f0f173ee06
commit
23b21cefbb
3 changed files with 14 additions and 4 deletions
|
|
@ -24,8 +24,14 @@ func _ready() -> void:
|
|||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta: float) -> void:
|
||||
move_progress += delta * snake_speed
|
||||
if Input.get_vector("left","right","up","down").length() > 0:
|
||||
want_direction = Input.get_vector("left","right","up","down")
|
||||
if Input.is_action_just_pressed("left"):
|
||||
want_direction = Vector2.LEFT
|
||||
elif Input.is_action_just_pressed("right"):
|
||||
want_direction = Vector2.RIGHT
|
||||
elif Input.is_action_just_pressed("up"):
|
||||
want_direction = Vector2.UP
|
||||
elif Input.is_action_just_pressed("down"):
|
||||
want_direction = Vector2.DOWN
|
||||
position = lerp(start_pos,target_pos,move_progress)
|
||||
if move_progress >= 1:
|
||||
get_new_target()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue