dynamic instantiation of bullets, bullet factory, multiple triggers, teleporting crates

This commit is contained in:
OddlyTimbot committed 2026-06-29 20:58:57 -04:00
1 parent d5fc80ff7b
commit b4bae4bb14
13 files changed
+290 -55

No files matched your search

+15
View File
@@ -0,0 +1,15 @@
[gd_scene format=3 uid="uid://bp51pocvj7p3x"]
[ext_resource type="Script" uid="uid://bvy43aky6y3er" path="res://scripts/bullet.gd" id="1_mkf8s"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_y25gk"]
size = Vector2(10, 4)
[node name="Bullet" type="Area2D" unique_id=397024757]
script = ExtResource("1_mkf8s")
[node name="CollisionShape2D" type="CollisionShape2D" parent="." unique_id=1862785605]
shape = SubResource("RectangleShape2D_y25gk")
debug_color = Color(0.92602646, 0.20405883, 0.46076977, 0.41960785)
[connection signal="body_entered" from="." to="." method="_on_body_entered"]
+1 -1
View File
@@ -4,7 +4,7 @@
[sub_resource type="RectangleShape2D" id="RectangleShape2D_uwrxv"]
[node name="Crate" type="RigidBody2D" unique_id=1609374030]
[node name="Crate" type="RigidBody2D" unique_id=1609374030 groups=["shootable"]]
rotation = -0.68311554
script = ExtResource("1_b66cd")
metadata/_edit_group_ = true
+52 -38
View File
@@ -1,16 +1,14 @@
[gd_scene format=3 uid="uid://ch6sfehmsskcs"]
[ext_resource type="Script" uid="uid://dtv434qd1rfmu" path="res://scripts/game.gd" id="1_lnu2h"]
[ext_resource type="Script" uid="uid://g4wclr5vnxk6" path="res://scripts/trigger.gd" id="1_uwrxv"]
[ext_resource type="Script" uid="uid://b5c00ybml8rj" path="res://scripts/scene_manager.gd" id="2_lbhrr"]
[ext_resource type="Script" uid="uid://b1obldvd2etx7" path="res://scripts/player.gd" id="2_yqjtg"]
[ext_resource type="PackedScene" uid="uid://byl4bdrupii3k" path="res://scenes/player.tscn" id="4_iywne"]
[ext_resource type="PackedScene" uid="uid://b6cmg0k8qjoxi" path="res://scenes/crate.tscn" id="5_iywne"]
[ext_resource type="PackedScene" uid="uid://b3hgbbmb0nohj" path="res://scenes/trigger.tscn" id="5_p57ef"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_8cj0n"]
[sub_resource type="CircleShape2D" id="CircleShape2D_8cj0n"]
[sub_resource type="CircleShape2D" id="CircleShape2D_uwrxv"]
[sub_resource type="WorldBoundaryShape2D" id="WorldBoundaryShape2D_iywne"]
[node name="Game" type="Node2D" unique_id=981419409]
script = ExtResource("1_lnu2h")
@@ -18,58 +16,74 @@ script = ExtResource("1_lnu2h")
[node name="SceneManager" type="Node2D" parent="." unique_id=323246552]
script = ExtResource("2_lbhrr")
[node name="StaticBody2D" type="StaticBody2D" parent="." unique_id=1863997109]
position = Vector2(555, 409)
[node name="Player" parent="." unique_id=2145223914 instance=ExtResource("4_iywne")]
position = Vector2(490, 380)
[node name="Crates" type="Node2D" parent="." unique_id=207771395]
[node name="Crate" parent="Crates" unique_id=1609374030 instance=ExtResource("5_iywne")]
position = Vector2(951, 332.99997)
[node name="Crate3" parent="Crates" unique_id=249514132 instance=ExtResource("5_iywne")]
position = Vector2(731, 340)
[node name="Crate2" parent="Crates" unique_id=1603366376 instance=ExtResource("5_iywne")]
position = Vector2(558, 368)
[node name="Walls" type="Node2D" parent="." unique_id=80334518]
[node name="StaticBody2D" type="StaticBody2D" parent="Walls" unique_id=1863997109]
position = Vector2(553.00006, 401)
scale = Vector2(3.4000025, 1)
metadata/_edit_group_ = true
[node name="CollisionShape2D" type="CollisionShape2D" parent="StaticBody2D" unique_id=1910670137]
[node name="CollisionShape2D" type="CollisionShape2D" parent="Walls/StaticBody2D" unique_id=1910670137]
shape = SubResource("RectangleShape2D_8cj0n")
[node name="StaticBody2D3" type="StaticBody2D" parent="." unique_id=2089762008]
[node name="StaticBody2D4" type="StaticBody2D" parent="Walls" unique_id=823918434]
position = Vector2(485.00006, 409)
scale = Vector2(3.4000025, 1)
metadata/_edit_group_ = true
[node name="CollisionShape2D" type="CollisionShape2D" parent="Walls/StaticBody2D4" unique_id=1243761990]
shape = SubResource("RectangleShape2D_8cj0n")
[node name="StaticBody2D3" type="StaticBody2D" parent="Walls" unique_id=2089762008]
position = Vector2(734.00006, 377)
scale = Vector2(3.4000025, 1)
metadata/_edit_group_ = true
[node name="CollisionShape2D" type="CollisionShape2D" parent="StaticBody2D3" unique_id=892222577]
[node name="CollisionShape2D" type="CollisionShape2D" parent="Walls/StaticBody2D3" unique_id=892222577]
shape = SubResource("RectangleShape2D_8cj0n")
[node name="StaticBody2D2" type="StaticBody2D" parent="." unique_id=2038269484]
[node name="StaticBody2D2" type="StaticBody2D" parent="Walls" unique_id=2038269484]
position = Vector2(681.00006, 398)
rotation = -0.7375178
scale = Vector2(3.4000025, 1)
metadata/_edit_group_ = true
[node name="CollisionShape2D" type="CollisionShape2D" parent="StaticBody2D2" unique_id=1636593491]
[node name="CollisionShape2D" type="CollisionShape2D" parent="Walls/StaticBody2D2" unique_id=1636593491]
shape = SubResource("RectangleShape2D_8cj0n")
[node name="Trigger" type="Area2D" parent="." unique_id=1742156972]
[node name="StaticBody2D5" type="StaticBody2D" parent="Walls" unique_id=564687476]
[node name="CollisionShape2D" type="CollisionShape2D" parent="Walls/StaticBody2D5" unique_id=1147447008]
position = Vector2(0, 588)
shape = SubResource("WorldBoundaryShape2D_iywne")
[node name="Triggers" type="Node2D" parent="." unique_id=1195236992]
[node name="Trigger" parent="Triggers" unique_id=229441825 instance=ExtResource("5_p57ef")]
position = Vector2(621.00006, 465.00006)
scale = Vector2(4.2, 4.2)
script = ExtResource("1_uwrxv")
metadata/_edit_group_ = true
[node name="CollisionShape2D" type="CollisionShape2D" parent="Trigger" unique_id=1581030951]
shape = SubResource("CircleShape2D_8cj0n")
debug_color = Color(0.3285461, 0.6189337, 0.22834331, 0.41960785)
[node name="Trigger2" parent="Triggers" unique_id=1474950249 instance=ExtResource("5_p57ef")]
position = Vector2(817, 445)
intent = "fan"
[node name="Player" type="CharacterBody2D" parent="." unique_id=1939613595]
position = Vector2(535.00006, 379.00003)
scale = Vector2(1.4799998, 1.4799998)
script = ExtResource("2_yqjtg")
metadata/_edit_group_ = true
[node name="Trigger3" parent="Triggers" unique_id=205623468 instance=ExtResource("5_p57ef")]
position = Vector2(953.99994, 442.99997)
intent = "teleport"
[node name="CollisionShape2D" type="CollisionShape2D" parent="Player" unique_id=312922488]
shape = SubResource("CircleShape2D_uwrxv")
debug_color = Color(0.39731503, 0.48776567, 0.95015794, 0.41960785)
[node name="Crates" type="Node2D" parent="." unique_id=207771395]
[node name="Crate" parent="Crates" unique_id=1609374030 instance=ExtResource("5_iywne")]
position = Vector2(625, 345.99997)
[node name="Crate2" parent="Crates" unique_id=1603366376 instance=ExtResource("5_iywne")]
position = Vector2(736, 347.99997)
[connection signal="areaTriggerSignal" from="Trigger" to="." method="_on_trigger"]
[connection signal="body_entered" from="Trigger" to="Trigger" method="_on_body_entered"]
[connection signal="areaTriggerSignal" from="Triggers/Trigger" to="." method="_on_trigger"]
[connection signal="areaTriggerSignal" from="Triggers/Trigger2" to="." method="_on_trigger"]
[connection signal="areaTriggerSignal" from="Triggers/Trigger3" to="." method="_on_trigger"]
+26
View File
@@ -0,0 +1,26 @@
[gd_scene format=3 uid="uid://byl4bdrupii3k"]
[ext_resource type="Script" uid="uid://b1obldvd2etx7" path="res://scripts/player.gd" id="1_3vyb7"]
[sub_resource type="CircleShape2D" id="CircleShape2D_uwrxv"]
[node name="Player" type="CharacterBody2D" unique_id=2145223914]
scale = Vector2(1.4799998, 1.4799998)
script = ExtResource("1_3vyb7")
metadata/_edit_group_ = true
[node name="CollisionShape2D" type="CollisionShape2D" parent="." unique_id=775715684]
shape = SubResource("CircleShape2D_uwrxv")
debug_color = Color(0.39731503, 0.48776567, 0.95015794, 0.41960785)
[node name="RightCast" type="RayCast2D" parent="." unique_id=967990879]
target_position = Vector2(16.891893, 0)
[node name="LeftCast" type="RayCast2D" parent="." unique_id=926020029]
target_position = Vector2(-17.56757, -0.67567575)
[node name="RightSpawn" type="Marker2D" parent="." unique_id=72314368]
position = Vector2(12.837839, -8.1081085)
[node name="LeftSpawn" type="Marker2D" parent="." unique_id=374152113]
position = Vector2(-12.837839, -8.108109)
+16
View File
@@ -0,0 +1,16 @@
[gd_scene format=3 uid="uid://b3hgbbmb0nohj"]
[ext_resource type="Script" uid="uid://g4wclr5vnxk6" path="res://scripts/trigger.gd" id="1_du5ex"]
[sub_resource type="CircleShape2D" id="CircleShape2D_8cj0n"]
[node name="Trigger" type="Area2D" unique_id=229441825]
scale = Vector2(4.2, 4.2)
script = ExtResource("1_du5ex")
metadata/_edit_group_ = true
[node name="CollisionShape2D" type="CollisionShape2D" parent="." unique_id=1121443164]
shape = SubResource("CircleShape2D_8cj0n")
debug_color = Color(0.3285461, 0.6189337, 0.22834331, 0.41960785)
[connection signal="body_entered" from="." to="." method="_on_body_entered"]