basic player movement
This commit is contained in:
parent
f1eaee23c3
commit
5510d89edc
3 changed files with 43 additions and 1 deletions
11
gmtk_2024/scripts/player_movement.gd
Normal file
11
gmtk_2024/scripts/player_movement.gd
Normal file
|
@ -0,0 +1,11 @@
|
|||
extends CharacterBody2D
|
||||
|
||||
@export var speed = 50
|
||||
|
||||
func get_input():
|
||||
var input_direction = Input.get_axis("player_left", "player_right")
|
||||
velocity.x = input_direction * speed
|
||||
|
||||
func _physics_process(delta):
|
||||
get_input()
|
||||
move_and_slide()
|
Loading…
Add table
Add a link
Reference in a new issue