Creating campus scene, adding simple player node for testing
This commit is contained in:
18
entities/player/player.gd
Normal file
18
entities/player/player.gd
Normal file
@@ -0,0 +1,18 @@
|
||||
extends CharacterBody2D
|
||||
|
||||
@export var speed = 400
|
||||
|
||||
func _physics_process(_delta):
|
||||
velocity.x = 0
|
||||
velocity.y = 0
|
||||
|
||||
if Input.is_action_pressed("move_down"):
|
||||
velocity.y = speed
|
||||
elif Input.is_action_pressed("move_up"):
|
||||
velocity.y = -speed
|
||||
elif Input.is_action_pressed("move_right"):
|
||||
velocity.x = speed
|
||||
elif Input.is_action_pressed("move_left"):
|
||||
velocity.x = -speed
|
||||
|
||||
move_and_slide()
|
||||
Reference in New Issue
Block a user