Add Player Movement animation to the target cell

This commit is contained in:
2022-07-16 09:14:20 +01:00
parent 24cc1b8f04
commit 263d323d58
2 changed files with 22 additions and 2 deletions

View File

@ -1,3 +1,17 @@
extends Node2D
export var starting_pos : Vector2 = Vector2.ZERO
export var map_position : Vector2 = Vector2.ZERO
var target_position : Vector2 = Vector2.ZERO
var moving : bool = false
func _physics_process(delta):
# If the 2 positions are close enough, then not moving
moving = false if target_position.round() == position.round() else true
if not moving: return
#TODO: Replace with tween magic
position += (target_position - position)/2.5