This repository has been archived on 2023-10-28. You can view files and clone it, but cannot push or open issues or pull requests.
2DHackAndSlay/Scripts/Player/PlayerController.gd

17 lines
394 B
GDScript3
Raw Normal View History

extends CharacterBody2D
@export var speed = 50
2023-02-02 22:09:00 +00:00
func get_move_vector():
var input_direction = Input.get_vector("move_left", "move_right", "move_up", "move_down").normalized()
return input_direction
2023-02-02 22:09:00 +00:00
func _physics_process(delta):
2023-02-02 22:09:00 +00:00
# Set Velcoity to Move Vector times speed
self.velocity = get_move_vector() * speed
# Do the Physics-Calculations of the Player
self.move_and_slide()
2023-02-02 22:09:00 +00:00
pass