Add lever and jump pad components with activation logic

This commit is contained in:
2025-04-25 22:41:35 +02:00
parent 9b2ca61163
commit 8959fd4b9f
323 changed files with 12844 additions and 18 deletions

35
objects/big_coin.tscn Normal file
View File

@@ -0,0 +1,35 @@
[gd_scene load_steps=6 format=3 uid="uid://bargnp4twtmxg"]
[ext_resource type="Texture2D" uid="uid://djifxc5x0dyrw" path="res://sprites/ppc_tileset.png" id="1_aya2w"]
[ext_resource type="Script" path="res://scripts/components/collectable.gd" id="2_7cph7"]
[ext_resource type="Resource" uid="uid://bsnr5v2b2mfsl" path="res://resources/collectables/big_coin.tres" id="3_lk3av"]
[ext_resource type="Script" path="res://scripts/components/fade_away.gd" id="4_wkrj0"]
[sub_resource type="CircleShape2D" id="CircleShape2D_3ask2"]
radius = 9.0
[node name="Big Coin" type="Area2D"]
scale = Vector2(2, 2)
collision_layer = 2
collision_mask = 4
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
shape = SubResource("CircleShape2D_3ask2")
[node name="Sprite2D" type="Sprite2D" parent="."]
texture = ExtResource("1_aya2w")
hframes = 12
vframes = 12
frame = 51
[node name="Collectable" type="Node" parent="." node_paths=PackedStringArray("area2d") groups=["coins"]]
script = ExtResource("2_7cph7")
area2d = NodePath("..")
collectable_data = ExtResource("3_lk3av")
[node name="FadeAwayComponent" type="Node" parent="." node_paths=PackedStringArray("sprite2d", "root", "area2d")]
script = ExtResource("4_wkrj0")
sprite2d = NodePath("../Sprite2D")
fade_duration = 0.4
root = NodePath("..")
area2d = NodePath("..")

34
objects/big_treasure.tscn Normal file
View File

@@ -0,0 +1,34 @@
[gd_scene load_steps=6 format=3 uid="uid://d08dfqmirnd66"]
[ext_resource type="Texture2D" uid="uid://djifxc5x0dyrw" path="res://sprites/ppc_tileset.png" id="1_1co1x"]
[ext_resource type="Script" path="res://scripts/components/collectable.gd" id="2_cujcq"]
[ext_resource type="Resource" uid="uid://b6xqotmke54x" path="res://resources/collectables/big_treasure.tres" id="3_k64cr"]
[ext_resource type="Script" path="res://scripts/components/fade_away.gd" id="4_nw7tw"]
[sub_resource type="CircleShape2D" id="CircleShape2D_3ask2"]
radius = 9.0
[node name="Big Treasure" type="Area2D"]
collision_layer = 2
collision_mask = 4
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
shape = SubResource("CircleShape2D_3ask2")
[node name="Sprite2D" type="Sprite2D" parent="."]
texture = ExtResource("1_1co1x")
hframes = 12
vframes = 12
frame = 64
[node name="Collectable" type="Node" parent="." node_paths=PackedStringArray("area2d") groups=["coins"]]
script = ExtResource("2_cujcq")
area2d = NodePath("..")
collectable_data = ExtResource("3_k64cr")
[node name="FadeAwayComponent" type="Node" parent="." node_paths=PackedStringArray("sprite2d", "root", "area2d")]
script = ExtResource("4_nw7tw")
sprite2d = NodePath("../Sprite2D")
fade_duration = 0.4
root = NodePath("..")
area2d = NodePath("..")

View File

@@ -1,4 +1,4 @@
[gd_scene load_steps=19 format=3 uid="uid://bqi5s710xb1ju"]
[gd_scene load_steps=21 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"]
@@ -15,6 +15,8 @@
[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="Script" path="res://scripts/components/trigger_lever_component.gd" id="17_hglfj"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_hdsg1"]
size = Vector2(16, 31)
@@ -27,7 +29,7 @@ radius = 48.0
[node name="Brick Player" type="CharacterBody2D"]
collision_layer = 4
collision_mask = 11
collision_mask = 43
script = ExtResource("1_8j4h4")
[node name="Root" type="Node2D" parent="."]
@@ -132,5 +134,11 @@ collision_mask = 2
[node name="CollisionShape2D" type="CollisionShape2D" parent="MagneticArea"]
shape = SubResource("CircleShape2D_ps31c")
[node name="CanBeLaunchedComponent" type="Node" parent="."]
script = ExtResource("16_kemlv")
[node name="TriggerLeverComponent" type="Node" parent="."]
script = ExtResource("17_hglfj")
[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"]

28
objects/cage.tscn Normal file
View File

@@ -0,0 +1,28 @@
[gd_scene load_steps=5 format=3 uid="uid://to2xnqev0pu1"]
[ext_resource type="Texture2D" uid="uid://djifxc5x0dyrw" path="res://sprites/ppc_tileset.png" id="1_5poh3"]
[ext_resource type="Script" path="res://scripts/components/cage_component.gd" id="2_unomj"]
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_aivtb"]
texture = ExtResource("1_5poh3")
2:9/size_in_atlas = Vector2i(2, 2)
2:9/0 = 0
2:9/0/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, 16, -16, 16, 16, -16, 16)
[sub_resource type="TileSet" id="TileSet_67qt2"]
tile_size = Vector2i(32, 32)
physics_layer_0/collision_layer = 1
sources/0 = SubResource("TileSetAtlasSource_aivtb")
[node name="Cage" type="Node2D"]
scale = Vector2(2, 2)
[node name="TileMapLayer" type="TileMapLayer" parent="."]
position = Vector2(20, 4)
tile_map_data = PackedByteArray(0, 0, 255, 255, 255, 255, 0, 0, 2, 0, 9, 0, 0, 0)
tile_set = SubResource("TileSet_67qt2")
[node name="CageComponent" type="Node" parent="." node_paths=PackedStringArray("root")]
script = ExtResource("2_unomj")
root = NodePath("..")
should_free = false

View File

@@ -75,9 +75,11 @@ debug_color = Color(0.913521, 0.265052, 0.323172, 0.42)
[node name="Left Ray" type="RayCast2D" parent="."]
position = Vector2(-16, 13)
target_position = Vector2(0, 8)
[node name="Right Ray" type="RayCast2D" parent="."]
position = Vector2(16, 13)
target_position = Vector2(0, 8)
[node name="FlashingComponent" type="Node" parent="." node_paths=PackedStringArray("sprite", "health_component")]
process_mode = 3

28
objects/jump_pad.tscn Normal file
View File

@@ -0,0 +1,28 @@
[gd_scene load_steps=4 format=3 uid="uid://cm3rixnnev1pg"]
[ext_resource type="Texture2D" uid="uid://djifxc5x0dyrw" path="res://sprites/ppc_tileset.png" id="1_ctugi"]
[ext_resource type="Script" path="res://scripts/components/jump_pad_component.gd" id="2_2ypfs"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_ci3ij"]
size = Vector2(16, 6)
[node name="Jump pad" type="Area2D"]
collision_layer = 0
collision_mask = 4
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
position = Vector2(0, 5)
shape = SubResource("RectangleShape2D_ci3ij")
[node name="Sprite2D" type="Sprite2D" parent="."]
texture = ExtResource("1_ctugi")
hframes = 12
vframes = 12
frame = 120
[node name="JumpPadComponent" type="Node" parent="." node_paths=PackedStringArray("area2d", "sprite2d")]
script = ExtResource("2_2ypfs")
jump_force = 1110.0
area2d = NodePath("..")
sprite2d = NodePath("../Sprite2D")
start_animation_index = 120

27
objects/lever.tscn Normal file
View File

@@ -0,0 +1,27 @@
[gd_scene load_steps=4 format=3 uid="uid://bd51frym6mm7v"]
[ext_resource type="Texture2D" uid="uid://djifxc5x0dyrw" path="res://sprites/ppc_tileset.png" id="1_psg62"]
[ext_resource type="Script" path="res://scripts/components/lever_component.gd" id="2_0p0wb"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_ke5tv"]
size = Vector2(12, 13)
[node name="Lever" type="Area2D" groups=["levers"]]
collision_layer = 0
collision_mask = 4
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
position = Vector2(0, 1.5)
shape = SubResource("RectangleShape2D_ke5tv")
[node name="Sprite2D" type="Sprite2D" parent="."]
texture = ExtResource("1_psg62")
hframes = 12
vframes = 12
frame = 75
[node name="LeverComponent" type="Node" parent="." node_paths=PackedStringArray("area2d", "sprite2d")]
script = ExtResource("2_0p0wb")
area2d = NodePath("..")
sprite2d = NodePath("../Sprite2D")
start_animation_index = 75

34
objects/treasure.tscn Normal file
View File

@@ -0,0 +1,34 @@
[gd_scene load_steps=6 format=3 uid="uid://073ts5cxtwbl"]
[ext_resource type="Texture2D" uid="uid://djifxc5x0dyrw" path="res://sprites/ppc_tileset.png" id="1_uh3ex"]
[ext_resource type="Script" path="res://scripts/components/collectable.gd" id="2_i1ssp"]
[ext_resource type="Resource" uid="uid://bws2xldndlre1" path="res://resources/collectables/treasure.tres" id="3_uknsr"]
[ext_resource type="Script" path="res://scripts/components/fade_away.gd" id="4_ccbcr"]
[sub_resource type="CircleShape2D" id="CircleShape2D_3ask2"]
radius = 9.0
[node name="Treasure" type="Area2D"]
collision_layer = 2
collision_mask = 4
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
shape = SubResource("CircleShape2D_3ask2")
[node name="Sprite2D" type="Sprite2D" parent="."]
texture = ExtResource("1_uh3ex")
hframes = 12
vframes = 12
frame = 66
[node name="Collectable" type="Node" parent="." node_paths=PackedStringArray("area2d") groups=["coins"]]
script = ExtResource("2_i1ssp")
area2d = NodePath("..")
collectable_data = ExtResource("3_uknsr")
[node name="FadeAwayComponent" type="Node" parent="." node_paths=PackedStringArray("sprite2d", "root", "area2d")]
script = ExtResource("4_ccbcr")
sprite2d = NodePath("../Sprite2D")
fade_duration = 0.4
root = NodePath("..")
area2d = NodePath("..")