Added level 1

This commit is contained in:
2026-07-02 21:34:10 +03:00
parent 5be263d3bb
commit 1c093fd1ff
20 changed files with 323 additions and 42 deletions
+22 -1
View File
@@ -7,12 +7,14 @@ signal dead()
const MAX_HEALTH = 100.0
const CAMERA_OFFSET_FACTOR = 0.4
const CAMERA_OFFSET_TIME = 1.0
@export_group("Movement", "move")
@export_range(0.0, 1000.0) var move_max_speed_normal := 350
@export_range(0.0, 1000.0) var move_max_speed_slowed := 250
@export_range(0.0, 1000.0) var move_acceleration := 1000.0
@export_range(0.0, 1000.0) var move_acceleration := 750.0
@export_group("Jump", "jump")
@export_range(0.0, 1000.0) var jump_max_fall_speed := 1000
@@ -30,8 +32,15 @@ const MAX_HEALTH = 100.0
@export_range(0.0, 1000.0) var slow_down_sustain := 0.70
@export_range(0.0, 1000.0) var slow_down_release := 0.25
@export var camera_limit_right := 10000000:
set(value):
camera_limit_right = value
if is_node_ready():
_update_camera_limit_right()
var _slow_down_tween: Tween
var _camera_offset_tween: Tween
var _last_wall_normal: = 0.0
@@ -79,6 +88,8 @@ func _ready() -> void:
func _physics_process(delta: float) -> void:
_update_camera_limit_right()
if is_on_floor():
floor_coyote_time_timer.start()
_last_wall_normal = 0.0
@@ -136,6 +147,12 @@ func _physics_process(delta: float) -> void:
move_and_slide()
state_machine.physics_process(delta)
if _camera_offset_tween and _camera_offset_tween.is_running():
_camera_offset_tween.kill()
_camera_offset_tween = create_tween()
var new_camera_position := Vector2(velocity.x * CAMERA_OFFSET_FACTOR, 0)
_camera_offset_tween.tween_property(camera, "position", new_camera_position, CAMERA_OFFSET_TIME)
func _input(event: InputEvent) -> void:
@@ -153,6 +170,10 @@ func deal_damage(value: float) -> void:
dead.emit()
func _update_camera_limit_right() -> void:
camera.limit_right = camera_limit_right
func _can_attack() -> bool:
if not attack_cooldown_timer.is_stopped():
return false
+13 -13
View File
@@ -64,10 +64,6 @@ region = Rect2(96, 192, 32, 32)
atlas = ExtResource("2_cjfdk")
region = Rect2(128, 192, 32, 32)
[sub_resource type="AtlasTexture" id="AtlasTexture_t56eh"]
atlas = ExtResource("2_cjfdk")
region = Rect2(0, 64, 32, 32)
[sub_resource type="AtlasTexture" id="AtlasTexture_6pmmc"]
atlas = ExtResource("2_cjfdk")
region = Rect2(32, 64, 32, 32)
@@ -88,9 +84,9 @@ region = Rect2(128, 64, 32, 32)
atlas = ExtResource("2_cjfdk")
region = Rect2(160, 64, 32, 32)
[sub_resource type="AtlasTexture" id="AtlasTexture_8pcyd"]
[sub_resource type="AtlasTexture" id="AtlasTexture_t56eh"]
atlas = ExtResource("2_cjfdk")
region = Rect2(0, 96, 32, 32)
region = Rect2(0, 64, 32, 32)
[sub_resource type="AtlasTexture" id="AtlasTexture_fq5t3"]
atlas = ExtResource("2_cjfdk")
@@ -112,6 +108,10 @@ region = Rect2(128, 96, 32, 32)
atlas = ExtResource("2_cjfdk")
region = Rect2(160, 96, 32, 32)
[sub_resource type="AtlasTexture" id="AtlasTexture_8pcyd"]
atlas = ExtResource("2_cjfdk")
region = Rect2(0, 96, 32, 32)
[sub_resource type="AtlasTexture" id="AtlasTexture_66tqw"]
atlas = ExtResource("2_cjfdk")
region = Rect2(96, 256, 32, 32)
@@ -181,9 +181,6 @@ animations = [{
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_t56eh")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_6pmmc")
}, {
"duration": 1.0,
@@ -197,6 +194,9 @@ animations = [{
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_4neg5")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_t56eh")
}],
"loop": 1,
"name": &"run_left",
@@ -204,9 +204,6 @@ animations = [{
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_8pcyd")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_fq5t3")
}, {
"duration": 1.0,
@@ -220,6 +217,9 @@ animations = [{
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_588tj")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_8pcyd")
}],
"loop": 1,
"name": &"run_right",
@@ -555,7 +555,7 @@ shape = SubResource("CapsuleShape2D_bhunq")
[node name="PlayerSprite" type="AnimatedSprite2D" parent="." unique_id=2025942250]
sprite_frames = SubResource("SpriteFrames_bhunq")
animation = &"wall_right"
animation = &"run_left"
[node name="BladeSprite" type="AnimatedSprite2D" parent="." unique_id=1561250707]
position = Vector2(0, 8)
@@ -31,6 +31,7 @@ func exit() -> void:
func physics_process(_delta: float) -> void:
player.player_sprite.speed_scale = max(player.velocity.x / player.move_max_speed_normal, 0.5)
if player.is_on_floor():
if is_zero_approx(player.velocity.x):
switch_state.emit(idle)