Add skill management system with unlocker and save functionality

This commit is contained in:
2025-04-27 14:15:03 +02:00
parent f880d1a811
commit 49a652a5b1
16 changed files with 294 additions and 32 deletions

View File

@@ -1,4 +1,4 @@
[gd_scene load_steps=24 format=3 uid="uid://bqi5s710xb1ju"]
[gd_scene load_steps=26 format=3 uid="uid://bqi5s710xb1ju"]
[ext_resource type="Script" path="res://scripts/player.gd" id="1_8j4h4"]
[ext_resource type="Texture2D" uid="uid://b7gp0gqvkv8j4" path="res://sprites/MrBrick_base.png" id="2_bc55y"]
@@ -9,17 +9,19 @@
[ext_resource type="Script" path="res://scripts/components/health.gd" id="7_tqjk8"]
[ext_resource type="Script" path="res://scripts/components/player_death.gd" id="8_1v23d"]
[ext_resource type="Script" path="res://scripts/components/knockback.gd" id="9_rjyu4"]
[ext_resource type="Script" path="res://scripts/components/brick_throw.gd" id="10_u0v3b"]
[ext_resource type="PackedScene" uid="uid://bymro4t7angv5" path="res://objects/brick.tscn" id="11_4d0cj"]
[ext_resource type="Script" path="res://scripts/components/stomp_damage_component.gd" id="12_payr4"]
[ext_resource type="Script" path="res://scripts/components/flashing_component.gd" id="13_hrtyn"]
[ext_resource type="Script" path="res://scripts/components/invulnerability_component.gd" id="14_jopig"]
[ext_resource type="Script" path="res://scripts/components/magnetic_skill.gd" id="15_4df3h"]
[ext_resource type="Script" path="res://scripts/components/can_be_launched_component.gd" id="16_kemlv"]
[ext_resource type="Resource" uid="uid://dw5ee2lpeypnb" path="res://resources/skills/brick_throw.tres" id="16_smbir"]
[ext_resource type="Script" path="res://scripts/components/trigger_lever_component.gd" id="17_hglfj"]
[ext_resource type="AudioStream" uid="uid://duj2q0rqytaxg" path="res://sfx/jump.wav" id="18_pysae"]
[ext_resource type="AudioStream" uid="uid://bmfn6p88gy575" path="res://sfx/player_hurt.wav" id="19_7anly"]
[ext_resource type="AudioStream" uid="uid://ycgtf6wj7mto" path="res://sfx/heal.wav" id="20_bptj5"]
[ext_resource type="Script" path="res://scripts/skill_manager.gd" id="20_ppfy7"]
[ext_resource type="Script" path="res://scripts/resources/skill_data.gd" id="21_d0oiv"]
[ext_resource type="Resource" uid="uid://d3bjre2etov1n" path="res://resources/skills/magnetic.tres" id="22_vnsgd"]
[ext_resource type="Script" path="res://scripts/components/skill_unlocker_component.gd" id="23_qsv2c"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_hdsg1"]
size = Vector2(16, 31)
@@ -90,20 +92,11 @@ script = ExtResource("9_rjyu4")
character_body = NodePath("..")
knockback_force = 1500.0
[node name="BrickThrowComponent" type="Node" parent="." node_paths=PackedStringArray("player_controller", "timer")]
script = ExtResource("10_u0v3b")
brick_scene = ExtResource("11_4d0cj")
fire_rate = 0.3
player_controller = NodePath("..")
timer = NodePath("../ThrowTimer")
[node name="ThrowTimer" type="Timer" parent="."]
[node name="StompDamageComponent" type="Node" parent="." node_paths=PackedStringArray("area2d", "root")]
script = ExtResource("12_payr4")
damage = 4.0
area2d = NodePath("../StompDamageArea")
root = NodePath("..")
[node name="InvulnerabilityComponent" type="Node" parent="." node_paths=PackedStringArray("flashing_component")]
script = ExtResource("14_jopig")
flashing_component = NodePath("../FlashingComponent Base")
[node name="FlashingComponent Base" type="Node" parent="." node_paths=PackedStringArray("sprite", "health_component")]
script = ExtResource("13_hrtyn")
@@ -123,15 +116,19 @@ sprite = NodePath("../Root/Right Eye")
flash_duration = 1.0
health_component = NodePath("../HealthComponent")
[node name="InvulnerabilityComponent" type="Node" parent="." node_paths=PackedStringArray("flashing_component")]
script = ExtResource("14_jopig")
flashing_component = NodePath("../FlashingComponent Base")
[node name="MagneticSkillComponent" type="Node" parent="." node_paths=PackedStringArray("magnetic_area", "root")]
script = ExtResource("15_4df3h")
magnetic_area = NodePath("../MagneticArea")
[node name="StompDamageComponent" type="Node" parent="." node_paths=PackedStringArray("area2d", "root")]
script = ExtResource("12_payr4")
damage = 4.0
area2d = NodePath("../StompDamageArea")
root = NodePath("..")
magnetic_move_duration = 0.9
[node name="SkillManager" type="Node" parent="."]
script = ExtResource("20_ppfy7")
available_skills = Array[ExtResource("21_d0oiv")]([ExtResource("22_vnsgd"), ExtResource("16_smbir")])
[node name="SkillUnlockerComponent" type="Node" parent="." node_paths=PackedStringArray("skill_manager")]
script = ExtResource("23_qsv2c")
skill_manager = NodePath("../SkillManager")
[node name="MagneticArea" type="Area2D" parent="."]
collision_layer = 0

View File

@@ -24,7 +24,7 @@ shader_parameter/enabled = false
shader_parameter/tint = Color(1, 1, 1, 1)
[sub_resource type="RectangleShape2D" id="RectangleShape2D_ejbqt"]
size = Vector2(25, 31)
size = Vector2(34, 31)
[node name="Enemy" type="CharacterBody2D"]
collision_layer = 8
@@ -61,7 +61,6 @@ left_ray = NodePath("../Left Ray")
right_ray = NodePath("../Right Ray")
[node name="PeriodicShootingComponent" type="Node" parent="." node_paths=PackedStringArray("side_to_side_movement", "root", "bullet_spawn_right", "bullet_spawn_left")]
process_mode = 3
script = ExtResource("5_m03v0")
side_to_side_movement = NodePath("../SideToSideMovement")
root = NodePath("..")
@@ -80,7 +79,7 @@ collision_layer = 8
collision_mask = 20
[node name="CollisionShape2D" type="CollisionShape2D" parent="Hitbox"]
position = Vector2(-1.5, 0.5)
position = Vector2(-2, 0.5)
shape = SubResource("RectangleShape2D_ejbqt")
debug_color = Color(0.913521, 0.265052, 0.323172, 0.42)

View File

@@ -2,5 +2,5 @@
[ext_resource type="Script" path="res://scripts/game_manager.gd" id="1_58t7u"]
[node name="Node" type="Node"]
[node name="GameManager" type="Node"]
script = ExtResource("1_58t7u")

17
objects/killzone.tscn Normal file
View File

@@ -0,0 +1,17 @@
[gd_scene load_steps=3 format=3 uid="uid://bqom4cm7r18db"]
[ext_resource type="Script" path="res://scripts/components/damage_component.gd" id="1_un3fl"]
[sub_resource type="WorldBoundaryShape2D" id="WorldBoundaryShape2D_cr00c"]
[node name="Killzone" type="Area2D"]
collision_layer = 0
collision_mask = 4
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
shape = SubResource("WorldBoundaryShape2D_cr00c")
[node name="DamageComponent" type="Node" parent="." node_paths=PackedStringArray("area2d")]
script = ExtResource("1_un3fl")
damage = 999999.0
area2d = NodePath("..")

View File

@@ -0,0 +1,9 @@
[gd_scene load_steps=3 format=3 uid="uid://coayig4dxelo2"]
[ext_resource type="Script" path="res://scripts/components/brick_throw.gd" id="1_hniwk"]
[ext_resource type="PackedScene" uid="uid://bymro4t7angv5" path="res://objects/brick.tscn" id="2_4txoq"]
[node name="BrickThrowComponent" type="Node"]
script = ExtResource("1_hniwk")
brick_scene = ExtResource("2_4txoq")
fire_rate = 0.3

View File

@@ -0,0 +1,6 @@
[gd_scene load_steps=2 format=3 uid="uid://cunyndudjh2he"]
[ext_resource type="Script" path="res://scripts/components/magnetic_skill.gd" id="1_lwbas"]
[node name="MagneticSkill" type="Node"]
script = ExtResource("1_lwbas")