Removed useless variable for movement function
This commit is contained in:
parent
8e4d2d8ca9
commit
308967fccc
|
@ -25,27 +25,27 @@ func _process(delta: float) -> void:
|
|||
direction.x -= 1
|
||||
if Input.is_action_just_pressed("ui_left"):
|
||||
last_direction = Vector2i(-1,0)
|
||||
move(false)
|
||||
move()
|
||||
if Input.is_action_pressed("ui_right"):
|
||||
direction.x += 1
|
||||
if Input.is_action_just_pressed("ui_right"):
|
||||
last_direction = Vector2i(1,0)
|
||||
move(false)
|
||||
move()
|
||||
if Input.is_action_pressed("ui_up"):
|
||||
direction.y -= 1
|
||||
if Input.is_action_just_pressed("ui_up"):
|
||||
last_direction = Vector2i(0,-1)
|
||||
move(false)
|
||||
move()
|
||||
if Input.is_action_pressed("ui_down"):
|
||||
direction.y += 1
|
||||
if Input.is_action_just_pressed("ui_down"):
|
||||
last_direction = Vector2i(0,1)
|
||||
move(false)
|
||||
move()
|
||||
|
||||
if MoveTimer.is_stopped():
|
||||
move(false)
|
||||
move()
|
||||
|
||||
func move(repeated : bool) -> void:
|
||||
func move() -> void:
|
||||
if last_direction.x:
|
||||
direction.y = 0
|
||||
if last_direction.y:
|
||||
|
@ -56,7 +56,6 @@ func move(repeated : bool) -> void:
|
|||
|
||||
if not MoveRay.is_colliding():
|
||||
position += Vector2(TILE_SIZE * direction)
|
||||
elif not repeated:
|
||||
move(true)
|
||||
|
||||
|
||||
MoveTimer.start(MOVE_TIME)
|
||||
|
|
Loading…
Reference in a new issue