feat: add gameScene; add player movement;

This commit is contained in:
2026-08-18 09:47:21 +02:00
parent 4e215d5d8f
commit c9722e45a9
3551 changed files with 8088 additions and 6 deletions
+19 -3
View File
@@ -1,11 +1,27 @@
extends CharacterBody2D
@export var move_speed: float = 100
@export var hp: int = 10
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
pass # Replace with function body.
var damage: float = 2
print(damage)
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
pass
var move_vector: Vector2 = Input.get_vector("ui_left", "ui_right", "ui_up", "ui_down")
velocity = move_vector * move_speed
if velocity.x > 0:
$AnimatedSprite2D.play("move_right")
print(velocity)
if velocity.x < 0:
$AnimatedSprite2D.play("move_left")
print(velocity)
if velocity.y > 0:
$AnimatedSprite2D.play("move_down")
print(velocity)
if velocity.y < 0:
$AnimatedSprite2D.play("move_up")
print(velocity)
move_and_slide()