45 lines
1.3 KiB
Plaintext
45 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 = 10.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\")
|
|
move_and_collide(direction * SPEED)
|
|
"
|
|
|
|
[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(22, 22)
|
|
|
|
[node name="CharacterBody2D" type="CharacterBody2D"]
|
|
collision_mask = 2
|
|
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="."]
|