designed map
This commit is contained in:
1
scripts/chest.gd
Normal file
1
scripts/chest.gd
Normal file
@@ -0,0 +1 @@
|
||||
extends StaticBody2D
|
||||
17
scripts/player.gd
Normal file
17
scripts/player.gd
Normal file
@@ -0,0 +1,17 @@
|
||||
extends CharacterBody2D
|
||||
class_name Player
|
||||
|
||||
@export var speed = 100
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
velocity = Vector2.ZERO
|
||||
if Input.is_action_pressed("ui_down"):
|
||||
velocity += Vector2.DOWN
|
||||
if Input.is_action_pressed("ui_up"):
|
||||
velocity += Vector2.UP
|
||||
if Input.is_action_pressed("ui_left"):
|
||||
velocity += Vector2.LEFT
|
||||
if Input.is_action_pressed("ui_right"):
|
||||
velocity += Vector2.RIGHT
|
||||
velocity = velocity.normalized() * speed
|
||||
move_and_slide()
|
||||
Reference in New Issue
Block a user