Refactor collectable components to C# and update resource scripts for consistency

This commit is contained in:
2025-08-21 18:01:13 +02:00
parent d84f7d1740
commit 9d0f502cc2
16 changed files with 179 additions and 190 deletions

View File

@@ -1,9 +1,9 @@
[gd_scene load_steps=7 format=3 uid="uid://bargnp4twtmxg"] [gd_scene load_steps=7 format=3 uid="uid://bargnp4twtmxg"]
[ext_resource type="Texture2D" uid="uid://djifxc5x0dyrw" path="res://sprites/ppc_tileset.png" id="1_aya2w"] [ext_resource type="Texture2D" uid="uid://djifxc5x0dyrw" path="res://sprites/ppc_tileset.png" id="1_aya2w"]
[ext_resource type="Script" uid="uid://pa1bwc4no08q" path="res://scripts/components/collectable.gd" id="2_7cph7"] [ext_resource type="Script" uid="uid://r4jybneigfcn" path="res://scripts/components/CollectableComponent.cs" id="2_htmrw"]
[ext_resource type="Resource" uid="uid://bsnr5v2b2mfsl" path="res://resources/collectables/big_coin.tres" id="3_lk3av"] [ext_resource type="Resource" uid="uid://bsnr5v2b2mfsl" path="res://resources/collectables/big_coin.tres" id="3_lk3av"]
[ext_resource type="Script" uid="uid://bg75hnr3q6grk" path="res://scripts/components/fade_away.gd" id="4_wkrj0"] [ext_resource type="Script" uid="uid://bjln6jb1sigx2" path="res://scripts/components/FadeAwayComponent.cs" id="4_62p7g"]
[ext_resource type="AudioStream" uid="uid://bceic1csr8rq3" path="res://sfx/pickup_coin_2.wav" id="5_dbffd"] [ext_resource type="AudioStream" uid="uid://bceic1csr8rq3" path="res://sfx/pickup_coin_2.wav" id="5_dbffd"]
[sub_resource type="CircleShape2D" id="CircleShape2D_3ask2"] [sub_resource type="CircleShape2D" id="CircleShape2D_3ask2"]
@@ -23,19 +23,17 @@ hframes = 12
vframes = 12 vframes = 12
frame = 51 frame = 51
[node name="Collectable" type="Node" parent="." node_paths=PackedStringArray("area2d", "collision_shape", "sfx") groups=["coins"]] [node name="CollectableComponent" type="Node" parent="." node_paths=PackedStringArray("Area2D", "CollisionShape", "Sfx") groups=["coins"]]
script = ExtResource("2_7cph7") script = ExtResource("2_htmrw")
area2d = NodePath("..") Area2D = NodePath("..")
collision_shape = NodePath("../CollisionShape2D") CollisionShape = NodePath("../CollisionShape2D")
collectable_data = ExtResource("3_lk3av") Data = ExtResource("3_lk3av")
sfx = NodePath("../sfx") Sfx = NodePath("../sfx")
[node name="FadeAwayComponent" type="Node" parent="." node_paths=PackedStringArray("sprite2d", "root", "area2d")] [node name="FadeAwayComponent" type="Node" parent="." node_paths=PackedStringArray("Sprite", "Area")]
script = ExtResource("4_wkrj0") script = ExtResource("4_62p7g")
sprite2d = NodePath("../Sprite2D") Sprite = NodePath("../Sprite2D")
fade_duration = 0.4 Area = NodePath("..")
root = NodePath("..")
area2d = NodePath("..")
[node name="sfx" type="AudioStreamPlayer2D" parent="."] [node name="sfx" type="AudioStreamPlayer2D" parent="."]
stream = ExtResource("5_dbffd") stream = ExtResource("5_dbffd")

View File

@@ -1,7 +1,7 @@
[gd_scene load_steps=7 format=3 uid="uid://d08dfqmirnd66"] [gd_scene load_steps=7 format=3 uid="uid://d08dfqmirnd66"]
[ext_resource type="Texture2D" uid="uid://djifxc5x0dyrw" path="res://sprites/ppc_tileset.png" id="1_1co1x"] [ext_resource type="Texture2D" uid="uid://djifxc5x0dyrw" path="res://sprites/ppc_tileset.png" id="1_1co1x"]
[ext_resource type="Script" uid="uid://pa1bwc4no08q" path="res://scripts/components/collectable.gd" id="2_cujcq"] [ext_resource type="Script" uid="uid://r4jybneigfcn" path="res://scripts/components/CollectableComponent.cs" id="2_lthbn"]
[ext_resource type="Resource" uid="uid://b6xqotmke54x" path="res://resources/collectables/big_treasure.tres" id="3_k64cr"] [ext_resource type="Resource" uid="uid://b6xqotmke54x" path="res://resources/collectables/big_treasure.tres" id="3_k64cr"]
[ext_resource type="Script" uid="uid://bg75hnr3q6grk" path="res://scripts/components/fade_away.gd" id="4_nw7tw"] [ext_resource type="Script" uid="uid://bg75hnr3q6grk" path="res://scripts/components/fade_away.gd" id="4_nw7tw"]
[ext_resource type="AudioStream" uid="uid://wr7n5ivv06ux" path="res://sfx/pickup_coin_4.wav" id="5_fxf8v"] [ext_resource type="AudioStream" uid="uid://wr7n5ivv06ux" path="res://sfx/pickup_coin_4.wav" id="5_fxf8v"]
@@ -22,12 +22,12 @@ hframes = 12
vframes = 12 vframes = 12
frame = 64 frame = 64
[node name="Collectable" type="Node" parent="." node_paths=PackedStringArray("area2d", "collision_shape", "sfx") groups=["coins"]] [node name="CollectableComponent" type="Node" parent="." node_paths=PackedStringArray("Area2D", "CollisionShape", "Sfx") groups=["coins"]]
script = ExtResource("2_cujcq") script = ExtResource("2_lthbn")
area2d = NodePath("..") Area2D = NodePath("..")
collision_shape = NodePath("../CollisionShape2D") CollisionShape = NodePath("../CollisionShape2D")
collectable_data = ExtResource("3_k64cr") Data = ExtResource("3_k64cr")
sfx = NodePath("../sfx") Sfx = NodePath("../sfx")
[node name="FadeAwayComponent" type="Node" parent="." node_paths=PackedStringArray("sprite2d", "root", "area2d")] [node name="FadeAwayComponent" type="Node" parent="." node_paths=PackedStringArray("sprite2d", "root", "area2d")]
script = ExtResource("4_nw7tw") script = ExtResource("4_nw7tw")

View File

@@ -1,13 +1,14 @@
[gd_scene load_steps=10 format=3 uid="uid://bymro4t7angv5"] [gd_scene load_steps=11 format=3 uid="uid://bymro4t7angv5"]
[ext_resource type="Texture2D" uid="uid://djifxc5x0dyrw" path="res://sprites/ppc_tileset.png" id="1_1c3jb"] [ext_resource type="Texture2D" uid="uid://djifxc5x0dyrw" path="res://sprites/ppc_tileset.png" id="1_1c3jb"]
[ext_resource type="Script" uid="uid://cdnwrn8v05qhi" path="res://scripts/components/bullet_component.gd" id="2_i6t5k"] [ext_resource type="Script" uid="uid://cfw8nbrarex0i" path="res://scripts/components/BulletComponent.cs" id="2_r41xl"]
[ext_resource type="Script" uid="uid://dkmxhjtmu5xlb" path="res://scripts/components/damage_component.gd" id="3_8xipx"] [ext_resource type="Script" uid="uid://2i7p7v135u7c" path="res://scripts/components/DamageComponent.cs" id="3_h7wgh"]
[ext_resource type="Script" uid="uid://1tnr46o1ib4u" path="res://scripts/components/out_of_screen_component.gd" id="4_rdtjq"] [ext_resource type="Script" uid="uid://cs6u3sh68f43j" path="res://scripts/components/OutOfScreenComponent.cs" id="4_ihgvw"]
[ext_resource type="Script" uid="uid://bgty7040ams6s" path="res://scripts/components/projectile_init_component.gd" id="5_2vqt8"] [ext_resource type="Script" uid="uid://c7n6ecsobohjn" path="res://scripts/components/ProjectileInitComponent.cs" id="5_aiue8"]
[ext_resource type="Script" uid="uid://873un8agkyja" path="res://scripts/components/launch_component.gd" id="6_d0tcd"] [ext_resource type="Script" uid="uid://cbexrnnj47f87" path="res://scripts/components/LaunchComponent.cs" id="6_t4c40"]
[ext_resource type="Script" uid="uid://cvcnfrr1udco5" path="res://scripts/components/straight_motion_component.gd" id="7_r41xl"] [ext_resource type="Script" uid="uid://c7p06t0eax8am" path="res://scripts/components/StraightMotionComponent.cs" id="7_y10b5"]
[ext_resource type="PackedScene" uid="uid://c1iorglk708g0" path="res://objects/fxs/terrain_hit_fx.tscn" id="8_d0tcd"] [ext_resource type="PackedScene" uid="uid://c1iorglk708g0" path="res://objects/fxs/terrain_hit_fx.tscn" id="8_d0tcd"]
[ext_resource type="Script" uid="uid://cypxrqoeiihbf" path="res://scripts/components/TerrainHitFx.cs" id="9_y1xkr"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_ar0xf"] [sub_resource type="RectangleShape2D" id="RectangleShape2D_ar0xf"]
size = Vector2(16, 10) size = Vector2(16, 10)
@@ -25,12 +26,11 @@ hframes = 12
vframes = 12 vframes = 12
frame = 80 frame = 80
[node name="BulletComponent" type="Node" parent="." node_paths=PackedStringArray("root", "area2d", "hit_terrain_fx", "bullet_sprite")] [node name="BulletComponent" type="Node" parent="." node_paths=PackedStringArray("Area", "TerrainHitFx", "BulletSprite")]
script = ExtResource("2_i6t5k") script = ExtResource("2_r41xl")
root = NodePath("..") Area = NodePath("..")
area2d = NodePath("..") TerrainHitFx = NodePath("../TerrainHitFX")
hit_terrain_fx = NodePath("../TerrainHitFX") BulletSprite = NodePath("../Sprite2D")
bullet_sprite = NodePath("../Sprite2D")
[node name="VisibleOnScreenNotifier2D" type="VisibleOnScreenNotifier2D" parent="."] [node name="VisibleOnScreenNotifier2D" type="VisibleOnScreenNotifier2D" parent="."]
position = Vector2(0, 2.38419e-07) position = Vector2(0, 2.38419e-07)
@@ -38,30 +38,28 @@ scale = Vector2(0.8, 0.5)
[node name="Timer" type="Timer" parent="."] [node name="Timer" type="Timer" parent="."]
[node name="DamageComponent" type="Node" parent="." node_paths=PackedStringArray("area2d")] [node name="DamageComponent" type="Node" parent="." node_paths=PackedStringArray("Area", "DamageTimer")]
script = ExtResource("3_8xipx") script = ExtResource("3_h7wgh")
area2d = NodePath("..") Area = NodePath("..")
DamageTimer = NodePath("../Timer")
[node name="OutOfScreenComponent" type="Node" parent="." node_paths=PackedStringArray("visibility_notifier", "root")] [node name="OutOfScreenComponent" type="Node" parent="." node_paths=PackedStringArray("VisibilityNotifier")]
script = ExtResource("4_rdtjq") script = ExtResource("4_ihgvw")
visibility_notifier = NodePath("../VisibleOnScreenNotifier2D") VisibilityNotifier = NodePath("../VisibleOnScreenNotifier2D")
root = NodePath("..")
[node name="ProjectileInitComponent" type="Node" parent="." node_paths=PackedStringArray("launch_component")] [node name="ProjectileInitComponent" type="Node" parent="." node_paths=PackedStringArray("LaunchComponent")]
script = ExtResource("5_2vqt8") script = ExtResource("5_aiue8")
launch_component = NodePath("../LaunchComponent") LaunchComponent = NodePath("../LaunchComponent")
metadata/_custom_type_script = "uid://bgty7040ams6s" metadata/_custom_type_script = "uid://bgty7040ams6s"
[node name="LaunchComponent" type="Node2D" parent="." node_paths=PackedStringArray("root")] [node name="LaunchComponent" type="Node2D" parent="."]
script = ExtResource("6_d0tcd") script = ExtResource("6_t4c40")
root = NodePath(".")
speed = 180.0
metadata/_custom_type_script = "uid://873un8agkyja" metadata/_custom_type_script = "uid://873un8agkyja"
[node name="StraightMotionComponent" type="Node" parent="." node_paths=PackedStringArray("root", "launch_component")] [node name="StraightMotionComponent" type="Node" parent="." node_paths=PackedStringArray("LaunchComponent")]
script = ExtResource("7_r41xl") script = ExtResource("7_y10b5")
root = NodePath("..") LaunchComponent = NodePath("../LaunchComponent")
launch_component = NodePath("../LaunchComponent")
metadata/_custom_type_script = "uid://cvcnfrr1udco5" metadata/_custom_type_script = "uid://cvcnfrr1udco5"
[node name="TerrainHitFX" parent="." instance=ExtResource("8_d0tcd")] [node name="TerrainHitFX" parent="." instance=ExtResource("8_d0tcd")]
script = ExtResource("9_y1xkr")

View File

@@ -1,25 +1,24 @@
[gd_scene load_steps=48 format=3 uid="uid://bqi5s710xb1ju"] [gd_scene load_steps=48 format=3 uid="uid://bqi5s710xb1ju"]
[ext_resource type="Script" uid="uid://ccuddyoakg04u" path="res://scripts/player.gd" id="1_8j4h4"] [ext_resource type="Script" uid="uid://csel4s0e4g5uf" path="res://scripts/components/PlayerController.cs" id="1_yysbb"]
[ext_resource type="Shader" uid="uid://bs4xvm4qkurpr" path="res://shaders/hit_flash.tres" id="2_lgb3u"] [ext_resource type="Shader" uid="uid://bs4xvm4qkurpr" path="res://shaders/hit_flash.tres" id="2_lgb3u"]
[ext_resource type="Script" uid="uid://btlm1f3l70il" path="res://scripts/components/PlatformMovementComponent.cs" id="2_o1ihh"]
[ext_resource type="Texture2D" uid="uid://jl1gwqchhpdc" path="res://sprites/left_eye.png" id="3_2srrh"] [ext_resource type="Texture2D" uid="uid://jl1gwqchhpdc" path="res://sprites/left_eye.png" id="3_2srrh"]
[ext_resource type="Script" uid="uid://b3mrdvre1y567" path="res://scripts/components/ship_movement.gd" id="3_p4n66"] [ext_resource type="Script" uid="uid://cty54itmnudfm" path="res://scripts/components/ShipMovementComponent.cs" id="3_ur2y5"]
[ext_resource type="Texture2D" uid="uid://iiawtnwmeny3" path="res://sprites/right_eye.png" id="4_ccn81"] [ext_resource type="Texture2D" uid="uid://iiawtnwmeny3" path="res://sprites/right_eye.png" id="4_ccn81"]
[ext_resource type="Script" uid="uid://oxeqvxkgj87j" path="res://scripts/components/flip_player.gd" id="5_geu10"]
[ext_resource type="Texture2D" uid="uid://0l454rfplmqg" path="res://sprites/MrBrick_base-sheet.png" id="5_yysbb"] [ext_resource type="Texture2D" uid="uid://0l454rfplmqg" path="res://sprites/MrBrick_base-sheet.png" id="5_yysbb"]
[ext_resource type="Script" uid="uid://qeu80jy4vmuf" path="res://scripts/components/score.gd" id="6_fowa2"]
[ext_resource type="Script" uid="uid://btfsq0bvtrx3t" path="res://scripts/components/health.gd" id="7_tqjk8"]
[ext_resource type="Script" uid="uid://dkpu3121y88oo" path="res://scripts/components/player_death.gd" id="8_1v23d"]
[ext_resource type="Texture2D" uid="uid://dhkwyv6ayb5qb" path="res://sprites/flying_ship.png" id="8_6lsog"] [ext_resource type="Texture2D" uid="uid://dhkwyv6ayb5qb" path="res://sprites/flying_ship.png" id="8_6lsog"]
[ext_resource type="PackedScene" uid="uid://dyp4i4ru2j2jh" path="res://objects/fxs/explosion_fx.tscn" id="9_hwg11"] [ext_resource type="Script" uid="uid://dy78ak8eykw6e" path="res://scripts/components/FlipComponent.cs" id="9_yysbb"]
[ext_resource type="Script" uid="uid://nogmyshjrv57" path="res://scripts/components/knockback.gd" id="9_rjyu4"] [ext_resource type="Script" uid="uid://mnjg3p0aw1ow" path="res://scripts/components/CanPickUpComponent.cs" id="10_yysbb"]
[ext_resource type="Script" uid="uid://ulhswh4jjlc6" path="res://scripts/components/stomp_damage_component.gd" id="12_payr4"] [ext_resource type="Script" uid="uid://ccqb8kd5m0eh7" path="res://scripts/components/ScoreComponent.cs" id="11_o1ihh"]
[ext_resource type="Script" uid="uid://dqmbvuutd5c3c" path="res://scripts/components/flashing_component.gd" id="13_hrtyn"] [ext_resource type="Script" uid="uid://dgb8bqcri7nsj" path="res://scripts/components/HealthComponent.cs" id="12_ur2y5"]
[ext_resource type="Script" uid="uid://ijrli0x8ij8v" path="res://scripts/components/invulnerability_component.gd" id="14_jopig"] [ext_resource type="Script" uid="uid://byw1legrv1ep2" path="res://scripts/components/PlayerDeathComponent.cs" id="13_7til7"]
[ext_resource type="Script" uid="uid://6ffxsx3gknhr" path="res://scripts/components/can_be_launched_component.gd" id="16_kemlv"] [ext_resource type="Script" uid="uid://cgfynrn68lp12" path="res://scripts/components/KnockbackComponent.cs" id="14_e5pae"]
[ext_resource type="Script" uid="uid://cecelixl41t3j" path="res://scripts/components/InvulnerabilityComponent.cs" id="15_xuhvf"]
[ext_resource type="Resource" uid="uid://dw5ee2lpeypnb" path="res://resources/skills/brick_throw.tres" id="16_smbir"] [ext_resource type="Resource" uid="uid://dw5ee2lpeypnb" path="res://resources/skills/brick_throw.tres" id="16_smbir"]
[ext_resource type="Script" uid="uid://dvyd26ricriql" path="res://scripts/components/FlashingComponent.cs" id="16_uno3u"]
[ext_resource type="Resource" uid="uid://2glvryih82t1" path="res://resources/skills/fire_brick.tres" id="17_6y5qu"] [ext_resource type="Resource" uid="uid://2glvryih82t1" path="res://resources/skills/fire_brick.tres" id="17_6y5qu"]
[ext_resource type="Script" uid="uid://bpy6xtfm8l3hy" path="res://scripts/components/trigger_lever_component.gd" id="17_hglfj"] [ext_resource type="Script" uid="uid://dtg6115je7b5s" path="res://scripts/components/StompDamageComponent.cs" id="17_bl1gx"]
[ext_resource type="AudioStream" uid="uid://duj2q0rqytaxg" path="res://sfx/jump.wav" id="18_pysae"] [ext_resource type="AudioStream" uid="uid://duj2q0rqytaxg" path="res://sfx/jump.wav" id="18_pysae"]
[ext_resource type="Resource" uid="uid://cx5fsbexblp60" path="res://resources/skills/ice_brick.tres" id="18_umfbf"] [ext_resource type="Resource" uid="uid://cx5fsbexblp60" path="res://resources/skills/ice_brick.tres" id="18_umfbf"]
[ext_resource type="Resource" uid="uid://cdp8sex36vdq2" path="res://resources/skills/explosive_brick.tres" id="19_5wjb7"] [ext_resource type="Resource" uid="uid://cdp8sex36vdq2" path="res://resources/skills/explosive_brick.tres" id="19_5wjb7"]
@@ -29,15 +28,16 @@
[ext_resource type="Script" uid="uid://bya240e627ti6" path="res://scripts/resources/skill_data.gd" id="21_d0oiv"] [ext_resource type="Script" uid="uid://bya240e627ti6" 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="Resource" uid="uid://d3bjre2etov1n" path="res://resources/skills/magnetic.tres" id="22_vnsgd"]
[ext_resource type="Script" uid="uid://bjsyeo1n7bsri" path="res://scripts/components/skill_unlocker_component.gd" id="23_qsv2c"] [ext_resource type="Script" uid="uid://bjsyeo1n7bsri" path="res://scripts/components/skill_unlocker_component.gd" id="23_qsv2c"]
[ext_resource type="Script" uid="uid://bo506l4x0808e" path="res://scripts/components/HitComponent.cs" id="26_6n1ss"]
[ext_resource type="Script" uid="uid://cjcc7fia15wu3" path="res://scripts/components/CanBeLaunchedComponent.cs" id="27_oefns"]
[ext_resource type="PackedScene" uid="uid://bg76mtpcmfm2j" path="res://objects/ui/charging_bar_layer.tscn" id="28_3f5nm"] [ext_resource type="PackedScene" uid="uid://bg76mtpcmfm2j" path="res://objects/ui/charging_bar_layer.tscn" id="28_3f5nm"]
[ext_resource type="Script" uid="uid://cqau0810tjk4d" path="res://scripts/components/TriggerLeverComponent.cs" id="28_bnap0"]
[ext_resource type="PackedScene" uid="uid://b12tppjkkqpt4" path="res://objects/fxs/hit_particles.tscn" id="28_jh5m0"] [ext_resource type="PackedScene" uid="uid://b12tppjkkqpt4" path="res://objects/fxs/hit_particles.tscn" id="28_jh5m0"]
[ext_resource type="Script" uid="uid://ceq8n7yw7qxpi" path="res://scripts/components/hit_component.gd" id="29_jh5m0"]
[ext_resource type="Script" uid="uid://c1wtrgw0x77xo" path="res://scripts/components/platform_movement.gd" id="31_xoue7"]
[ext_resource type="AudioStream" uid="uid://dyev46uqusimi" path="res://sfx/shoot.wav" id="32_x2b7c"] [ext_resource type="AudioStream" uid="uid://dyev46uqusimi" path="res://sfx/shoot.wav" id="32_x2b7c"]
[ext_resource type="Script" uid="uid://d1ctdx52gskv1" path="res://scripts/components/ship_shooter.gd" id="34_gwc8i"] [ext_resource type="Script" uid="uid://d1ctdx52gskv1" path="res://scripts/components/ship_shooter.gd" id="34_gwc8i"]
[ext_resource type="PackedScene" uid="uid://dtem8jgcyoqar" path="res://objects/entities/green_laser.tscn" id="36_oxudy"] [ext_resource type="PackedScene" uid="uid://dtem8jgcyoqar" path="res://objects/entities/green_laser.tscn" id="36_oxudy"]
[ext_resource type="Script" uid="uid://cfeoalic0mu2j" path="res://scripts/components/kill_player_out_of_screen.gd" id="37_oxudy"] [ext_resource type="Script" uid="uid://diw6opv6yutgi" path="res://scripts/components/KillPlayerOutOfScreenComponent.cs" id="37_qec3q"]
[ext_resource type="Script" uid="uid://d32kd83lf86iy" path="res://scripts/components/progressive_damage_component.gd" id="38_o1ihh"] [ext_resource type="Script" uid="uid://3qy7rm28q66a" path="res://scripts/components/ProgressiveDamageComponent.cs" id="38_dhjci"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_xoue7"] [sub_resource type="ShaderMaterial" id="ShaderMaterial_xoue7"]
shader = ExtResource("2_lgb3u") shader = ExtResource("2_lgb3u")
@@ -83,33 +83,29 @@ scale_curve = SubResource("CurveTexture_xoue7")
color = Color(0.764706, 0.443137, 0, 1) color = Color(0.764706, 0.443137, 0, 1)
color_ramp = SubResource("GradientTexture1D_lgb3u") color_ramp = SubResource("GradientTexture1D_lgb3u")
[node name="Brick Player" type="CharacterBody2D" node_paths=PackedStringArray("ship_sprite") groups=["player"]] [node name="Brick Player" type="CharacterBody2D" node_paths=PackedStringArray("ShipSprite") groups=["player"]]
collision_layer = 4 collision_layer = 4
collision_mask = 43 collision_mask = 43
script = ExtResource("1_8j4h4") script = ExtResource("1_yysbb")
movement_types = { MovementTypes = Dictionary[String, NodePath]({
"platform": NodePath("Movements/PlatformMovement"), "platform": NodePath("Movements/PlatformMovement")
"ship": NodePath("Movements/ShipMovement") })
} ShipSprite = NodePath("Graphics/Ship")
ship_sprite = NodePath("Graphics/Ship")
[node name="Movements" type="Node" parent="."] [node name="Movements" type="Node" parent="."]
[node name="PlatformMovement" type="Node" parent="Movements" node_paths=PackedStringArray("jump_sfx", "rotation_target", "body")] [node name="PlatformMovement" type="Node2D" parent="Movements" node_paths=PackedStringArray("JumpSfx", "RotationTarget", "Body")]
script = ExtResource("31_xoue7") script = ExtResource("2_o1ihh")
jump_sfx = NodePath("../../sfx_jump") JumpSfx = NodePath("../../sfx_jump")
rotation_target = NodePath("../../Graphics/Root/Base") RotationTarget = NodePath("../../Graphics/Root/Base")
body = NodePath("../..") Body = NodePath("../..")
type = "platform"
[node name="ShipMovement" type="Node" parent="Movements" node_paths=PackedStringArray("body")] [node name="ShipMovement" type="Node2D" parent="Movements" node_paths=PackedStringArray("Body")]
script = ExtResource("3_p4n66") script = ExtResource("3_ur2y5")
max_speed = 360.0 MaxSpeed = 360.0
acceleration = 1200.0 Acceleration = 1200.0
friction = 800.0 Friction = 800.0
body = NodePath("../..") Body = NodePath("../..")
type = "ship"
metadata/_custom_type_script = "uid://b3mrdvre1y567"
[node name="Graphics" type="Node2D" parent="."] [node name="Graphics" type="Node2D" parent="."]
@@ -140,11 +136,11 @@ visible = false
position = Vector2(0, 0.5) position = Vector2(0, 0.5)
shape = SubResource("RectangleShape2D_hdsg1") shape = SubResource("RectangleShape2D_hdsg1")
[node name="FlipPlayerComponent" type="Node2D" parent="." node_paths=PackedStringArray("eye_left", "eye_right", "platform_movement")] [node name="FlipPlayerComponent" type="Node2D" parent="." node_paths=PackedStringArray("LeftEye", "RightEye", "PlatformMovement")]
script = ExtResource("5_geu10") script = ExtResource("9_yysbb")
eye_left = NodePath("../Graphics/Root/Left Eye") LeftEye = NodePath("../Graphics/Root/Left Eye")
eye_right = NodePath("../Graphics/Root/Right Eye") RightEye = NodePath("../Graphics/Root/Right Eye")
platform_movement = NodePath("../Movements/PlatformMovement") PlatformMovement = NodePath("../Movements/PlatformMovement")
[node name="StompDamageArea" type="Area2D" parent="."] [node name="StompDamageArea" type="Area2D" parent="."]
collision_layer = 0 collision_layer = 0
@@ -156,54 +152,57 @@ position = Vector2(0, 1)
shape = SubResource("RectangleShape2D_vad0t") shape = SubResource("RectangleShape2D_vad0t")
[node name="CanPickUpComponent" type="Node" parent="."] [node name="CanPickUpComponent" type="Node" parent="."]
script = ExtResource("10_yysbb")
[node name="ScoreComponent" type="Node" parent="."] [node name="ScoreComponent" type="Node" parent="."]
script = ExtResource("6_fowa2") script = ExtResource("11_o1ihh")
[node name="HealthComponent" type="Node" parent="." node_paths=PackedStringArray("hurt_fx", "heal_fx")] [node name="HealthComponent" type="Node2D" parent="." node_paths=PackedStringArray("HurtSfx", "HealSfx")]
script = ExtResource("7_tqjk8") script = ExtResource("12_ur2y5")
hurt_fx = NodePath("../sfx_hurt") HurtSfx = NodePath("../sfx_hurt")
heal_fx = NodePath("../sfx_heal") HealSfx = NodePath("../sfx_heal")
[node name="PlayerDeathComponent" type="Node2D" parent="."] [node name="PlayerDeathComponent" type="Node2D" parent="." node_paths=PackedStringArray("DeathSfx", "HealthComponent")]
process_mode = 3 process_mode = 3
script = ExtResource("8_1v23d") script = ExtResource("13_7til7")
death_effect = ExtResource("9_hwg11") DeathSfx = NodePath("../sfx_hurt")
HealthComponent = NodePath("../HealthComponent")
[node name="KnockbackComponent" type="Node" parent="." node_paths=PackedStringArray("character_body")] [node name="KnockbackComponent" type="Node" parent="." node_paths=PackedStringArray("Body", "HealthComponent")]
script = ExtResource("9_rjyu4") script = ExtResource("14_e5pae")
character_body = NodePath("..") Body = NodePath("..")
knockback_force = 1500.0 KnockbackForce = 1250.0
HealthComponent = NodePath("../HealthComponent")
[node name="ThrowTimer" type="Timer" parent="."] [node name="ThrowTimer" type="Timer" parent="."]
[node name="InvulnerabilityComponent" type="Node" parent="." node_paths=PackedStringArray("flashing_component")] [node name="InvulnerabilityComponent" type="Node" parent="." node_paths=PackedStringArray("FlashingComponent")]
script = ExtResource("14_jopig") script = ExtResource("15_xuhvf")
flashing_component = NodePath("../FlashingComponent Base") FlashingComponent = NodePath("../FlashingComponent Base")
[node name="FlashingComponent Base" type="Node" parent="." node_paths=PackedStringArray("sprite", "health_component")] [node name="FlashingComponent Base" type="Node" parent="." node_paths=PackedStringArray("Sprite", "HealthComponent")]
script = ExtResource("13_hrtyn") script = ExtResource("16_uno3u")
sprite = NodePath("../Graphics/Root/Base") Sprite = NodePath("../Graphics/Root/Base")
flash_duration = 1.0 FlashDuration = 1.0
health_component = NodePath("../HealthComponent") HealthComponent = NodePath("../HealthComponent")
[node name="FlashingComponent LEye" type="Node" parent="." node_paths=PackedStringArray("sprite", "health_component")] [node name="FlashingComponent LEye" type="Node" parent="." node_paths=PackedStringArray("Sprite", "HealthComponent")]
script = ExtResource("13_hrtyn") script = ExtResource("16_uno3u")
sprite = NodePath("../Graphics/Root/Left Eye") Sprite = NodePath("../Graphics/Root/Left Eye")
flash_duration = 1.0 FlashDuration = 1.0
health_component = NodePath("../HealthComponent") HealthComponent = NodePath("../HealthComponent")
[node name="FlashingComponent REye" type="Node" parent="." node_paths=PackedStringArray("sprite", "health_component")] [node name="FlashingComponent REye" type="Node" parent="." node_paths=PackedStringArray("Sprite", "HealthComponent")]
script = ExtResource("13_hrtyn") script = ExtResource("16_uno3u")
sprite = NodePath("../Graphics/Root/Right Eye") Sprite = NodePath("../Graphics/Root/Right Eye")
flash_duration = 1.0 FlashDuration = 1.0
health_component = NodePath("../HealthComponent") HealthComponent = NodePath("../HealthComponent")
[node name="StompDamageComponent" type="Node" parent="." node_paths=PackedStringArray("area2d", "root")] [node name="StompDamageComponent" type="Node" parent="." node_paths=PackedStringArray("Area", "Root")]
script = ExtResource("12_payr4") script = ExtResource("17_bl1gx")
damage = 4.0 Damage = 4.0
area2d = NodePath("../StompDamageArea") Area = NodePath("../StompDamageArea")
root = NodePath("..") Root = NodePath("..")
[node name="SkillManager" type="Node" parent="."] [node name="SkillManager" type="Node" parent="."]
script = ExtResource("20_ppfy7") script = ExtResource("20_ppfy7")
@@ -213,11 +212,11 @@ available_skills = Array[ExtResource("21_d0oiv")]([ExtResource("22_vnsgd"), ExtR
script = ExtResource("23_qsv2c") script = ExtResource("23_qsv2c")
skill_manager = NodePath("../SkillManager") skill_manager = NodePath("../SkillManager")
[node name="HitComponent" type="Node" parent="." node_paths=PackedStringArray("sprite", "health_component", "hit_fx")] [node name="HitComponent" type="Node" parent="." node_paths=PackedStringArray("Sprite", "Health", "HitFx")]
script = ExtResource("29_jh5m0") script = ExtResource("26_6n1ss")
sprite = NodePath("../Graphics/Root/Base") Sprite = NodePath("../Graphics/Root/Base")
health_component = NodePath("../HealthComponent") Health = NodePath("../HealthComponent")
hit_fx = NodePath("../HitParticles") HitFx = NodePath("../HitParticles")
metadata/_custom_type_script = "uid://ceq8n7yw7qxpi" metadata/_custom_type_script = "uid://ceq8n7yw7qxpi"
[node name="MagneticArea" type="Area2D" parent="."] [node name="MagneticArea" type="Area2D" parent="."]
@@ -229,10 +228,10 @@ visible = false
shape = SubResource("CircleShape2D_ps31c") shape = SubResource("CircleShape2D_ps31c")
[node name="CanBeLaunchedComponent" type="Node" parent="."] [node name="CanBeLaunchedComponent" type="Node" parent="."]
script = ExtResource("16_kemlv") script = ExtResource("27_oefns")
[node name="TriggerLeverComponent" type="Node" parent="."] [node name="TriggerLeverComponent" type="Node" parent="."]
script = ExtResource("17_hglfj") script = ExtResource("28_bnap0")
[node name="sfx_jump" type="AudioStreamPlayer2D" parent="."] [node name="sfx_jump" type="AudioStreamPlayer2D" parent="."]
stream = ExtResource("18_pysae") stream = ExtResource("18_pysae")
@@ -274,18 +273,13 @@ gizmo_extents = 1.0
position = Vector2(0, 3) position = Vector2(0, 3)
scale = Vector2(0.8, 1.9) scale = Vector2(0.8, 1.9)
[node name="KillPlayerOutOfScreen" type="Node" parent="." node_paths=PackedStringArray("screen_notifier", "health_component")] [node name="KillPlayerOutOfScreen" type="Node" parent="." node_paths=PackedStringArray("ScreenNotifier", "HealthComponent")]
script = ExtResource("37_oxudy") script = ExtResource("37_qec3q")
screen_notifier = NodePath("../VisibleOnScreenNotifier2D") ScreenNotifier = NodePath("../VisibleOnScreenNotifier2D")
health_component = NodePath("../HealthComponent") HealthComponent = NodePath("../HealthComponent")
[node name="ProgressiveDamageComponent" type="Node" parent="." node_paths=PackedStringArray("health_component", "sprite", "platform_movement")] [node name="ProgressiveDamageComponent" type="Node" parent="." node_paths=PackedStringArray("HealthComponent", "Sprite", "PlatformMovement")]
script = ExtResource("38_o1ihh") script = ExtResource("38_dhjci")
health_component = NodePath("../HealthComponent") HealthComponent = NodePath("../HealthComponent")
sprite = NodePath("../Graphics/Root/Base") Sprite = NodePath("../Graphics/Root/Base")
platform_movement = NodePath("../Movements/PlatformMovement") PlatformMovement = NodePath("../Movements/PlatformMovement")
min_jump_height = 100.0
jump_reduction_percentage = 0.15
[connection signal="on_death" from="HealthComponent" to="PlayerDeathComponent" method="_on_health_component_on_death"]
[connection signal="on_health_change" from="HealthComponent" to="KnockbackComponent" method="_on_health_component_on_health_change"]

View File

@@ -1,6 +1,6 @@
[gd_scene load_steps=8 format=3 uid="uid://c1iorglk708g0"] [gd_scene load_steps=8 format=3 uid="uid://c1iorglk708g0"]
[ext_resource type="Script" uid="uid://djfejwp6e402k" path="res://scripts/components/terrain_hit_fx.gd" id="1_22p6x"] [ext_resource type="Script" uid="uid://cypxrqoeiihbf" path="res://scripts/components/TerrainHitFx.cs" id="1_22p6x"]
[sub_resource type="GradientTexture1D" id="GradientTexture1D_6dbny"] [sub_resource type="GradientTexture1D" id="GradientTexture1D_6dbny"]

View File

@@ -1,8 +1,8 @@
[gd_resource type="Resource" script_class="CollectableResource" load_steps=2 format=3 uid="uid://bsnr5v2b2mfsl"] [gd_resource type="Resource" load_steps=2 format=3 uid="uid://bsnr5v2b2mfsl"]
[ext_resource type="Script" uid="uid://cb5f0mx0hrt3b" path="res://scripts/resources/collectable_resource.gd" id="1_fudbo"] [ext_resource type="Script" uid="uid://gptsgaw3agkf" path="res://scripts/resources/CollectableResource.cs" id="1_wfbgp"]
[resource] [resource]
script = ExtResource("1_fudbo") script = ExtResource("1_wfbgp")
amount = 5.0 Amount = 5.0
type = 0 Type = 0

View File

@@ -1,8 +1,8 @@
[gd_resource type="Resource" script_class="CollectableResource" load_steps=2 format=3 uid="uid://b6xqotmke54x"] [gd_resource type="Resource" load_steps=2 format=3 uid="uid://b6xqotmke54x"]
[ext_resource type="Script" uid="uid://cb5f0mx0hrt3b" path="res://scripts/resources/collectable_resource.gd" id="1_037vi"] [ext_resource type="Script" uid="uid://gptsgaw3agkf" path="res://scripts/resources/CollectableResource.cs" id="1_5mosu"]
[resource] [resource]
script = ExtResource("1_037vi") script = ExtResource("1_5mosu")
amount = 100.0 Amount = 50.0
type = 0 Type = 0

View File

@@ -1,8 +1,8 @@
[gd_resource type="Resource" script_class="CollectableResource" load_steps=2 format=3 uid="uid://b6apusc0jmi3x"] [gd_resource type="Resource" load_steps=2 format=3 uid="uid://b6apusc0jmi3x"]
[ext_resource type="Script" uid="uid://cb5f0mx0hrt3b" path="res://scripts/resources/collectable_resource.gd" id="1_2d5tb"] [ext_resource type="Script" uid="uid://gptsgaw3agkf" path="res://scripts/resources/CollectableResource.cs" id="1_d8txc"]
[resource] [resource]
script = ExtResource("1_2d5tb") script = ExtResource("1_d8txc")
amount = 1.0 Amount = 1.0
type = 1 Type = 1

View File

@@ -1,8 +1,8 @@
[gd_resource type="Resource" script_class="CollectableResource" load_steps=2 format=3 uid="uid://vql535ckoeqm"] [gd_resource type="Resource" load_steps=2 format=3 uid="uid://vql535ckoeqm"]
[ext_resource type="Script" uid="uid://cb5f0mx0hrt3b" path="res://scripts/resources/collectable_resource.gd" id="1_veemo"] [ext_resource type="Script" uid="uid://gptsgaw3agkf" path="res://scripts/resources/CollectableResource.cs" id="1_7pquc"]
[resource] [resource]
script = ExtResource("1_veemo") script = ExtResource("1_7pquc")
amount = 1.0 Amount = 1.0
type = 0 Type = 0

View File

@@ -1,9 +1,9 @@
[gd_resource type="Resource" script_class="CollectableResource" load_steps=2 format=3 uid="uid://2tl3yoh202no"] [gd_resource type="Resource" load_steps=2 format=3 uid="uid://2tl3yoh202no"]
[ext_resource type="Script" uid="uid://cb5f0mx0hrt3b" path="res://scripts/resources/collectable_resource.gd" id="1_brkhb"] [ext_resource type="Script" uid="uid://gptsgaw3agkf" path="res://scripts/resources/CollectableResource.cs" id="1_brkhb"]
[resource] [resource]
script = ExtResource("1_brkhb") script = ExtResource("1_brkhb")
amount = 0.25 Amount = 0.25
type = 2 Type = 2
metadata/_custom_type_script = "uid://cb5f0mx0hrt3b" metadata/_custom_type_script = "uid://cb5f0mx0hrt3b"

View File

@@ -1,8 +1,8 @@
[gd_resource type="Resource" script_class="CollectableResource" load_steps=2 format=3 uid="uid://bws2xldndlre1"] [gd_resource type="Resource" load_steps=2 format=3 uid="uid://bws2xldndlre1"]
[ext_resource type="Script" uid="uid://cb5f0mx0hrt3b" path="res://scripts/resources/collectable_resource.gd" id="1_w50p5"] [ext_resource type="Script" uid="uid://gptsgaw3agkf" path="res://scripts/resources/CollectableResource.cs" id="1_clntw"]
[resource] [resource]
script = ExtResource("1_w50p5") script = ExtResource("1_clntw")
amount = 50.0 Amount = 50.0
type = 0 Type = 0

View File

@@ -13,7 +13,7 @@ public partial class CollectableComponent : Node
[Export] public CollectableResource Data { get; set; } [Export] public CollectableResource Data { get; set; }
[Export] public AudioStreamPlayer2D Sfx {get; set; } [Export] public AudioStreamPlayer2D Sfx {get; set; }
[Signal] public delegate void CollectedEventHandler(Variant amount, CollectableType type, Node2D body); [Signal] public delegate void CollectedEventHandler(float amount, CollectableType type, Node2D body);
public override void _Ready() public override void _Ready()
{ {

View File

@@ -19,7 +19,7 @@ public partial class HealComponent : Node
Collectable.Collected += OnCollected; Collectable.Collected += OnCollected;
} }
private void OnCollected(Variant amount, CollectableType type, Node2D body) private void OnCollected(float amount, CollectableType type, Node2D body)
{ {
if (type != CollectableType.Health) return; if (type != CollectableType.Health) return;
@@ -28,8 +28,7 @@ public partial class HealComponent : Node
var healthComponent = body.GetNodeOrNull<HealthComponent>("HealthComponent"); var healthComponent = body.GetNodeOrNull<HealthComponent>("HealthComponent");
if (healthComponent == null) return; if (healthComponent == null) return;
var value = amount.AsSingle(); healthComponent.IncreaseHealth(amount);
healthComponent.IncreaseHealth(value);
if (HealFx != null) if (HealFx != null)
{ {
PlayHealFx(); PlayHealFx();

View File

@@ -28,9 +28,9 @@ public partial class RequirementComponent : Node
} }
} }
private void OnCollected(Variant amount, CollectableType type, Node2D body) private void OnCollected(float amount, CollectableType type, Node2D body)
{ {
AddProgress(amount.As<int>()); AddProgress((int)amount);
} }
private void AddProgress(int amount = 1) private void AddProgress(int amount = 1)

View File

@@ -31,11 +31,11 @@ public partial class ScoreComponent : Node
} }
} }
private void OnCollected(Variant amount, CollectableType type, Node2D body) private void OnCollected(float amount, CollectableType type, Node2D body)
{ {
if (type != CollectableType.Coin) return; if (type != CollectableType.Coin) return;
var coinAmount = amount.As<int>(); var coinAmount = (int)amount;
var currentCoins = (int)_gameManager.CurrentSessionState["coins_collected"]; var currentCoins = (int)_gameManager.CurrentSessionState["coins_collected"];
_gameManager.CurrentSessionState["coins_collected"] = currentCoins + coinAmount; _gameManager.CurrentSessionState["coins_collected"] = currentCoins + coinAmount;
} }