Crystalline-awakening/player.tscn
2025-05-17 17:50:12 +02:00

47 lines
1.3 KiB
Plaintext

[gd_scene load_steps=5 format=3 uid="uid://tpe1cb4ucx0b"]
[ext_resource type="Texture2D" uid="uid://b8l378t64365q" path="res://playerSprite.png" id="1_4flbx"]
[sub_resource type="GDScript" id="GDScript_4flbx"]
resource_name = "movementScript"
script/source = "extends CharacterBody2D
const SPEED = 300.0
const JUMP_VELOCITY = -400.0
func _physics_process(delta: float) -> void:
# Get the input direction and handle the movement/deceleration.
# As good practice, you should replace UI actions with custom gameplay actions.
var direction := Input.get_vector(\"moveLeft\", \"moveRight\", \"moveUp\", \"moveDown\")
if direction:
velocity = direction * SPEED
move_and_slide()
"
[sub_resource type="SpriteFrames" id="SpriteFrames_onrkg"]
animations = [{
"frames": [{
"duration": 1.0,
"texture": ExtResource("1_4flbx")
}],
"loop": true,
"name": &"default",
"speed": 5.0
}]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_i3pqv"]
size = Vector2(30, 28)
[node name="CharacterBody2D" type="CharacterBody2D"]
script = SubResource("GDScript_4flbx")
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
sprite_frames = SubResource("SpriteFrames_onrkg")
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
shape = SubResource("RectangleShape2D_i3pqv")
[node name="Camera2D" type="Camera2D" parent="."]