Added player

This commit is contained in:
theskywinds 2025-05-17 17:50:12 +02:00
parent bbc3447b92
commit 1c867d0f1c
4 changed files with 71 additions and 5 deletions

View File

@ -1,8 +1,8 @@
[gd_scene load_steps=5 format=3 uid="uid://bmvb0o7ohxcfd"] [gd_scene load_steps=5 format=3 uid="uid://bj1x4w8ek53u1"]
[ext_resource type="Texture2D" uid="uid://yqukd7l5xsxg" path="res://Cat on news.PNG" id="1_5b7ti"] [ext_resource type="Texture2D" uid="uid://yqukd7l5xsxg" path="res://Cat on news.PNG" id="1_5b7ti"]
[ext_resource type="Script" uid="uid://dseq7dsrcpds6" path="res://start_game.gd" id="1_i5qic"] [ext_resource type="Script" path="res://start_game.gd" id="1_i5qic"]
[ext_resource type="Script" uid="uid://br2tmqcmfkf7a" path="res://exit_game.gd" id="2_12kdf"] [ext_resource type="Script" path="res://exit_game.gd" id="2_12kdf"]
[sub_resource type="SystemFont" id="SystemFont_7yr4w"] [sub_resource type="SystemFont" id="SystemFont_7yr4w"]

View File

@ -1,7 +1,46 @@
[gd_scene format=3 uid="uid://c1xy5bf2p6vmh"] [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"] [node name="CharacterBody2D" type="CharacterBody2D"]
script = SubResource("GDScript_4flbx")
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."] [node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
sprite_frames = SubResource("SpriteFrames_onrkg")
[node name="CollisionShape2D" type="CollisionShape2D" parent="."] [node name="CollisionShape2D" type="CollisionShape2D" parent="."]
shape = SubResource("RectangleShape2D_i3pqv")
[node name="Camera2D" type="Camera2D" parent="."]

View File

@ -14,3 +14,26 @@ config/name="The crystaline adventure"
run/main_scene="uid://bmvb0o7ohxcfd" run/main_scene="uid://bmvb0o7ohxcfd"
config/features=PackedStringArray("4.4", "Forward Plus") config/features=PackedStringArray("4.4", "Forward Plus")
config/icon="res://icon.svg" config/icon="res://icon.svg"
[input]
moveLeft={
"deadzone": 0.2,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":65,"key_label":0,"unicode":97,"location":0,"echo":false,"script":null)
]
}
moveRight={
"deadzone": 0.2,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":68,"key_label":0,"unicode":100,"location":0,"echo":false,"script":null)
]
}
moveUp={
"deadzone": 0.2,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":87,"key_label":0,"unicode":119,"location":0,"echo":false,"script":null)
]
}
moveDown={
"deadzone": 0.2,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":83,"key_label":0,"unicode":115,"location":0,"echo":false,"script":null)
]
}

File diff suppressed because one or more lines are too long