Godot Version
4.3.stable
Question
So my current movement code is like tile based similar to pokemon red and is coded like this
const tile_size = 16
var moving:bool = false
var input_dir
func _physics_process(delta):
input_dir = Vector2.ZERO
if Input.is_action_pressed("MoveDown"):
input_dir = Vector2(0,1)
move()
elif Input.is_action_pressed("MoveUp"):
input_dir = Vector2(0,-1)
move()
elif Input.is_action_pressed("MoveLeft"):
input_dir = Vector2(-1,0)
move()
elif Input.is_action_pressed("MoveRight"):
input_dir = Vector2(1,0)
move()
func move():
if input_dir and moving == false:
moving = true
var tween = create_tween()
tween.tween_property(self, "position", position + input_dir * tile_size, 0.35)
tween.tween_callback(move_false)
func move_false():
moving = false
What would be the best way yall could think of for making this just smooth movement like not grid based ??