feat: add player scene and move script
CI / Test (pull_request) Successful in 22s

This commit is contained in:
nerpa committed 2026-05-10 09:55:05 +03:00
1 parent aaa40e8226
commit 63addff92e
4 files changed
+56

No files matched your search

+1
View File
@@ -6,6 +6,7 @@
.import/
export.cfg
export_presets.cfg
*.gd.uid
# Imported translations (automatically generated from CSV files)
*.translation
+19
View File
@@ -11,9 +11,28 @@ config_version=5
[application]
config/name="novast"
run/main_scene="uid://cc2rcjjhxub7p"
config/features=PackedStringArray("4.6", "Forward Plus")
config/icon="res://icon.svg"
[input]
move_left={
"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)
]
}
move_right={
"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)
]
}
jump={
"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":32,"key_label":0,"unicode":32,"location":0,"echo":false,"script":null)
]
}
[physics]
3d/physics_engine="Jolt Physics"
+16
View File
@@ -0,0 +1,16 @@
[gd_scene format=3 uid="uid://cc2rcjjhxub7p"]
[ext_resource type="Script" uid="uid://nqa2egumodp5" path="res://scripts/player/player.gd" id="1_8afob"]
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_o8nba"]
[node name="Player" type="CharacterBody2D" unique_id=1801952962]
script = ExtResource("1_8afob")
[node name="CollisionShape2D" type="CollisionShape2D" parent="." unique_id=925020035]
shape = SubResource("CapsuleShape2D_o8nba")
[node name="Sprite2D" type="Sprite2D" parent="." unique_id=1313216180]
[node name="Camera2D" type="Camera2D" parent="." unique_id=209519618]
visible = false
+20
View File
@@ -0,0 +1,20 @@
extends CharacterBody2D
const SPEED = 300.0
const JUMP_VELOCITY = -400.0
func _physics_process(delta: float) -> void:
if not is_on_floor():
velocity += get_gravity() * delta
if Input.is_action_just_pressed("jump") and is_on_floor():
velocity.y = JUMP_VELOCITY
var direction := Input.get_axis("move_left", "move_right")
if direction:
velocity.x = direction * SPEED
else:
velocity.x = move_toward(velocity.x, 0, SPEED)
move_and_slide()