Add level progression and UI updates; implement death screen and marketplace features

This commit is contained in:
2025-05-16 16:42:48 +02:00
parent 760ea15be1
commit f39cf573c0
16 changed files with 212 additions and 24 deletions

View File

@@ -6,5 +6,4 @@
[node name="Background Music" type="AudioStreamPlayer" parent="."]
stream = ExtResource("1_fuc3i")
autoplay = true
parameters/looping = true

View File

@@ -0,0 +1,47 @@
[gd_scene load_steps=5 format=3 uid="uid://c40r76qqacqie"]
[ext_resource type="Texture2D" uid="uid://cw42lvnqxubq2" path="res://sprites/PS_Tileset_10_nes.png" id="1_jmsgb"]
[ext_resource type="Script" uid="uid://r0a6xjicrh74" path="res://scripts/components/collapsable.gd" id="2_cs5vh"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_l44jt"]
size = Vector2(16, 16)
[sub_resource type="RectangleShape2D" id="RectangleShape2D_sfbe2"]
size = Vector2(16, 2)
[node name="Collapsing Block" type="StaticBody2D"]
[node name="Sprite2D" type="Sprite2D" parent="."]
texture = ExtResource("1_jmsgb")
hframes = 16
vframes = 12
frame = 182
[node name="StaticCollisionShape2D" type="CollisionShape2D" parent="."]
shape = SubResource("RectangleShape2D_l44jt")
[node name="Collapsable detector" type="Area2D" parent="."]
collision_mask = 4
[node name="AreaCollisionShape2D" type="CollisionShape2D" parent="Collapsable detector"]
position = Vector2(0, -8)
shape = SubResource("RectangleShape2D_sfbe2")
[node name="ToCollapseTimer" type="Timer" parent="."]
wait_time = 0.5
[node name="ResetTimer" type="Timer" parent="."]
[node name="CollapsableComponent" type="Node" parent="." node_paths=PackedStringArray("to_collapse_timer", "reset_timer", "sprite2d", "collision_shape")]
script = ExtResource("2_cs5vh")
to_collapse_timer = NodePath("../ToCollapseTimer")
reset_timer = NodePath("../ResetTimer")
sprite2d = NodePath("../Sprite2D")
collision_shape = NodePath("../StaticCollisionShape2D")
collapse_time = 0.75
reset_time = 3.0
[connection signal="body_entered" from="Collapsable detector" to="CollapsableComponent" method="_on_collapsable_detector_body_entered"]
[connection signal="body_exited" from="Collapsable detector" to="CollapsableComponent" method="_on_collapsable_detector_body_exited"]
[connection signal="timeout" from="ToCollapseTimer" to="CollapsableComponent" method="_on_to_collapse_timer_timeout"]
[connection signal="timeout" from="ResetTimer" to="CollapsableComponent" method="_on_reset_timer_timeout"]

View File

@@ -11,7 +11,7 @@ size = Vector2(16, 2)
[node name="Collapsing Bridge" type="StaticBody2D"]
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
[node name="StaticCollisionShape2D" type="CollisionShape2D" parent="."]
position = Vector2(0, -6)
shape = SubResource("RectangleShape2D_l44jt")
one_way_collision = true
@@ -25,7 +25,7 @@ frame = 56
[node name="Collapsable detector" type="Area2D" parent="."]
collision_mask = 4
[node name="CollisionShape2D" type="CollisionShape2D" parent="Collapsable detector"]
[node name="AreaCollisionShape2D" type="CollisionShape2D" parent="Collapsable detector"]
position = Vector2(0, -8)
shape = SubResource("RectangleShape2D_sfbe2")
@@ -39,7 +39,7 @@ script = ExtResource("2_3vvum")
to_collapse_timer = NodePath("../ToCollapseTimer")
reset_timer = NodePath("../ResetTimer")
sprite2d = NodePath("../Sprite2D")
collision_shape = NodePath("../CollisionShape2D")
collision_shape = NodePath("../StaticCollisionShape2D")
collapse_time = 0.75
reset_time = 3.0

View File

@@ -1,11 +1,12 @@
[gd_scene load_steps=3 format=3 uid="uid://b4eifkc31jsun"]
[gd_scene load_steps=4 format=3 uid="uid://b4eifkc31jsun"]
[ext_resource type="Script" uid="uid://dd30bgqiagi25" path="res://scripts/game_manager.gd" id="1_58t7u"]
[ext_resource type="PackedScene" uid="uid://h60obxmju6mo" path="res://scenes/level_village_1.tscn" id="2_bentb"]
[ext_resource type="PackedScene" uid="uid://chqb11pfoqmeb" path="res://scenes/level_village_2.tscn" id="3_ajlkg"]
[node name="GameManager" type="Node"]
script = ExtResource("1_58t7u")
level_scenes = Array[PackedScene]([ExtResource("2_bentb")])
level_scenes = Array[PackedScene]([ExtResource("2_bentb"), ExtResource("3_ajlkg")])
player_state = {
"coins": 0,
"current_level": 0,

View File

@@ -1,4 +1,4 @@
[gd_scene load_steps=13 format=4 uid="uid://fw5fbdy5gcmx"]
[gd_scene load_steps=19 format=4 uid="uid://fw5fbdy5gcmx"]
[ext_resource type="PackedScene" uid="uid://cawlpch2lk3a2" path="res://objects/level/world_environment.tscn" id="1_hb5r3"]
[ext_resource type="PackedScene" uid="uid://bqi5s710xb1ju" path="res://objects/entities/brick_player.tscn" id="1_lbnsn"]
@@ -11,6 +11,37 @@
[ext_resource type="TileSet" uid="uid://cu2sx7qigrqnv" path="res://resources/tilesets/village/terain.tres" id="9_etwin"]
[ext_resource type="TileSet" uid="uid://bc5a20s6kuy8e" path="res://resources/tilesets/village/entities.tres" id="10_8xrv5"]
[ext_resource type="TileSet" uid="uid://bbppo0irxdmqy" path="res://resources/tilesets/village/foreground.tres" id="11_0vx27"]
[ext_resource type="Script" uid="uid://8r1y8elyw7kt" path="res://scripts/console_management.gd" id="12_8xrv5"]
[sub_resource type="Gradient" id="Gradient_qb72p"]
colors = PackedColorArray(1, 1, 1, 1, 1, 1, 1, 0)
[sub_resource type="GradientTexture1D" id="GradientTexture1D_f1fvy"]
gradient = SubResource("Gradient_qb72p")
[sub_resource type="Curve" id="Curve_82d6e"]
_data = [Vector2(0, 1), 0.0, 0.0, 0, 0, Vector2(1, 0), 0.0, 0.0, 0, 0]
point_count = 2
[sub_resource type="CurveTexture" id="CurveTexture_7b7mt"]
curve = SubResource("Curve_82d6e")
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_lgb3u"]
resource_local_to_scene = true
lifetime_randomness = 1.0
particle_flag_disable_z = true
emission_shape = 1
emission_sphere_radius = 8.0
direction = Vector3(0.1, -0.5, 0)
initial_velocity_min = 200.0
initial_velocity_max = 400.0
gravity = Vector3(0, 80, 0)
damping_min = 400.0
damping_max = 800.0
scale_max = 3.0
scale_curve = SubResource("CurveTexture_7b7mt")
color = Color(0.764706, 0.443137, 0, 1)
color_ramp = SubResource("GradientTexture1D_f1fvy")
[sub_resource type="Resource" id="Resource_0nwt7"]
script = ExtResource("7_kl81p")
@@ -22,6 +53,9 @@ ease = 2
[node name="Brick Player" parent="." instance=ExtResource("1_lbnsn")]
[node name="HitParticles" parent="Brick Player" index="26"]
process_material = SubResource("ParticleProcessMaterial_lgb3u")
[node name="WorldEnvironment" parent="." instance=ExtResource("1_hb5r3")]
[node name="UI Layer" parent="." instance=ExtResource("2_lbnsn")]
@@ -58,3 +92,12 @@ tile_set = ExtResource("10_8xrv5")
[node name="Foreground layer" type="TileMapLayer" parent="."]
tile_set = ExtResource("11_0vx27")
[node name="ConsoleManagement" type="Node" parent="." node_paths=PackedStringArray("player_health", "skill_unlocker", "skill_manager")]
script = ExtResource("12_8xrv5")
player_health = NodePath("../Brick Player/HealthComponent")
skill_unlocker = NodePath("../Brick Player/SkillUnlockerComponent")
skill_manager = NodePath("../Brick Player/SkillManager")
metadata/_custom_type_script = "uid://8r1y8elyw7kt"
[editable path="Brick Player"]

View File

@@ -36,5 +36,6 @@ motion_scale = Vector2(0.3, 0.3)
motion_mirroring = Vector2(480, 0)
[node name="Sprite2D" type="Sprite2D" parent="Ground"]
scale = Vector2(1, 1.14074)
texture = ExtResource("4_jkhju")
centered = false

View File

@@ -1,9 +1,10 @@
[gd_resource type="Resource" script_class="SkillData" load_steps=5 format=3 uid="uid://2glvryih82t1"]
[gd_resource type="Resource" script_class="SkillData" load_steps=6 format=3 uid="uid://2glvryih82t1"]
[ext_resource type="PackedScene" uid="uid://daau4j5hbklk0" path="res://objects/entities/fire_brick.tscn" id="1_2g43l"]
[ext_resource type="Script" uid="uid://bya240e627ti6" path="res://scripts/resources/skill_data.gd" id="1_2j5ko"]
[ext_resource type="PackedScene" uid="uid://coayig4dxelo2" path="res://objects/player_skills/brick_throw_skill.tscn" id="1_g53fp"]
[ext_resource type="Resource" uid="uid://br84dsfa3ti04" path="res://resources/throw_behaviors/tap_throw_input.tres" id="2_dm5pj"]
[ext_resource type="Texture2D" uid="uid://cocbnr38qsikt" path="res://sprites/fire_brick_skill_icon.png" id="3_w87qb"]
[resource]
script = ExtResource("1_2j5ko")
@@ -17,3 +18,4 @@ config = {
"timer": NodePath("ThrowTimer")
}
cost = 150
icon = ExtResource("3_w87qb")

View File

@@ -1,9 +1,10 @@
[gd_resource type="Resource" script_class="SkillData" load_steps=5 format=3 uid="uid://cx5fsbexblp60"]
[gd_resource type="Resource" script_class="SkillData" load_steps=6 format=3 uid="uid://cx5fsbexblp60"]
[ext_resource type="PackedScene" uid="uid://bcmx07k12gcsc" path="res://objects/entities/ice_brick.tscn" id="1_ci3d1"]
[ext_resource type="PackedScene" uid="uid://coayig4dxelo2" path="res://objects/player_skills/brick_throw_skill.tscn" id="1_rflri"]
[ext_resource type="Resource" uid="uid://br84dsfa3ti04" path="res://resources/throw_behaviors/tap_throw_input.tres" id="2_hsgyv"]
[ext_resource type="Script" uid="uid://bya240e627ti6" path="res://scripts/resources/skill_data.gd" id="2_pspkt"]
[ext_resource type="Texture2D" uid="uid://c1qaxspv8aemf" path="res://sprites/ice_brick_skill_icon.png" id="3_6btth"]
[resource]
script = ExtResource("2_pspkt")
@@ -17,3 +18,4 @@ config = {
"timer": NodePath("ThrowTimer")
}
cost = 150
icon = ExtResource("3_6btth")

View File

@@ -1,7 +1,8 @@
[gd_resource type="TileSet" load_steps=13 format=3 uid="uid://bc5a20s6kuy8e"]
[gd_resource type="TileSet" load_steps=14 format=3 uid="uid://bc5a20s6kuy8e"]
[ext_resource type="Texture2D" uid="uid://djifxc5x0dyrw" path="res://sprites/ppc_tileset.png" id="1_ej5iv"]
[ext_resource type="PackedScene" uid="uid://54w4wisfj8v8" path="res://objects/entities/coin.tscn" id="2_31a0q"]
[ext_resource type="PackedScene" uid="uid://c40r76qqacqie" path="res://objects/entities/collapsing_block.tscn" id="3_31a0q"]
[ext_resource type="PackedScene" uid="uid://ct8fim6mduyl3" path="res://objects/entities/collapsing_bridge.tscn" id="3_x63lh"]
[ext_resource type="PackedScene" uid="uid://bargnp4twtmxg" path="res://objects/entities/big_coin.tscn" id="4_ov0dn"]
[ext_resource type="PackedScene" uid="uid://d08dfqmirnd66" path="res://objects/entities/big_treasure.tscn" id="5_xxibl"]
@@ -145,6 +146,7 @@ scenes/6/scene = ExtResource("7_0kjxj")
scenes/7/scene = ExtResource("8_83o0w")
scenes/8/scene = ExtResource("9_at40q")
scenes/9/scene = ExtResource("10_ivcjr")
scenes/10/scene = ExtResource("3_31a0q")
[resource]
physics_layer_0/collision_layer = 1

View File

@@ -319,10 +319,20 @@ limit_target = NodePath("../Terrain Layer")
metadata/_edit_lock_ = true
[node name="Child" parent="." instance=ExtResource("15_vqevu")]
position = Vector2(873, -577)
position = Vector2(954, -577)
[node name="UI Layer" parent="." instance=ExtResource("16_40fge")]
[node name="HUD" parent="UI Layer" index="0" node_paths=PackedStringArray("player_health")]
player_health = NodePath("../../Brick Player/HealthComponent")
[node name="DeathScreen" parent="UI Layer" index="1" node_paths=PackedStringArray("nodes_to_disable")]
nodes_to_disable = [NodePath("../../Brick Player")]
[node name="Marketplace" parent="UI Layer" index="3" node_paths=PackedStringArray("skill_unlocker", "components_to_disable")]
skill_unlocker = NodePath("../../Brick Player/SkillUnlockerComponent")
components_to_disable = [NodePath("../../Brick Player")]
[node name="Killzone" parent="." instance=ExtResource("17_qu4c0")]
position = Vector2(2600, 802)
@@ -344,4 +354,9 @@ skill_manager = NodePath("../Brick Player/SkillManager")
[node name="Global Light" parent="." instance=ExtResource("21_pifnu")]
[connection signal="on_death" from="Brick Player/HealthComponent" to="UI Layer/DeathScreen" method="on_player_death"]
[connection signal="on_death" from="Brick Player/HealthComponent" to="UI Layer/GameOverScreen" method="on_player_death"]
[editable path="Brick Player"]
[editable path="UI Layer"]
[editable path="Killzone"]

File diff suppressed because one or more lines are too long

View File

@@ -31,4 +31,9 @@ func on_exit_area_body_entered(_body: Node2D) -> void:
return
exit_triggered.emit()
gm.unlock_level(gm.player_state["current_level"] + 1)
call_deferred("go_to_next_level")
func go_to_next_level() -> void:
gm.try_to_go_to_next_level()

View File

@@ -126,8 +126,10 @@ func unlock_level(level_index: int) -> void:
func try_to_go_to_next_level() -> void:
if player_state["current_level"] + 1 < level_scenes.size() and player_state["current_level"] + 1 in player_state["unlocked_levels"]:
var next_level = player_state["current_level"] + 1
if next_level < level_scenes.size() and next_level in player_state["unlocked_levels"]:
player_state["current_level"] += 1
get_tree().change_scene_to_packed(level_scenes[next_level])
func quit_game() -> void:

View File

@@ -51,7 +51,7 @@ func apply_unlocked_skills() -> void:
for skill_data in available_skills:
if gm.is_skill_unlocked(skill_data.name):
print("Applying skill: ", skill_data.name)
add_skill(skill_data)
call_deferred("add_skill", skill_data)
else:
remove_skill(skill_data.name)

View File

@@ -21,7 +21,7 @@ func _ready() -> void:
var skills_to_unlock: Array[SkillData] = []
for skill in skill_data:
if skill in game_manager.player_state['unlocked_skills']:
if skill.name in game_manager.player_state['unlocked_skills']:
continue
skills_to_unlock.append(skill)
@@ -43,9 +43,13 @@ func _input(event: InputEvent) -> void:
buttons[0].grab_focus()
func get_button_text(skill: SkillData) -> String:
return skill.name + " " + str(skill.cost)
func create_upgrade_button(skill: SkillData):
var button := marketplace_button.instantiate() as Button
button.text = skill.name + " " + str(skill.cost)
button.text = get_button_text(skill)
button.icon = skill.icon
button.pressed.connect(func () -> void: _on_button_pressed(skill))
@@ -57,7 +61,7 @@ func create_upgrade_button(skill: SkillData):
func remove_button(skill: SkillData):
for child in grid.get_children():
if child.text == skill.name + str(skill.cost):
if child.text == get_button_text(skill):
child.queue_free()
break