grenades, dynamic instantiation, state machine

This commit is contained in:
OddlyTimbot committed 2026-05-04 21:00:27 -04:00
1 parent 7384736795
commit a200dd1a51
12 files changed
+329 -3

No files matched your search

+6 -2
View File
@@ -5,6 +5,7 @@
[ext_resource type="Script" uid="uid://cnm7tj6umtwtm" path="res://Scripts/scene_manager.gd" id="2_wowpa"]
[ext_resource type="PackedScene" uid="uid://caa73phf3ng5m" path="res://Scenes/player.tscn" id="3_wowpa"]
[ext_resource type="Script" uid="uid://4hekg0d8n04f" path="res://Scripts/trigger.gd" id="3_wrm1d"]
[ext_resource type="PackedScene" uid="uid://dotmw0uwnqv6w" path="res://Scenes/grenade.tscn" id="6_i6g32"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_2poj3"]
size = Vector2(84, 20)
@@ -54,10 +55,13 @@ debug_color = Color(0.7716697, 0.28327075, 0.8513461, 0.41960785)
position = Vector2(385, 428)
[node name="Crate2" parent="Crates" unique_id=1931037062 instance=ExtResource("2_3dryh")]
position = Vector2(430, 140)
position = Vector2(436, 433)
[node name="Crate4" parent="Crates" unique_id=585069069 instance=ExtResource("2_3dryh")]
position = Vector2(461, 134)
position = Vector2(481, 433)
[node name="Grenade" parent="." unique_id=638454305 instance=ExtResource("6_i6g32")]
position = Vector2(385, 375)
[connection signal="body_entered" from="Area2D" to="Area2D" method="_on_body_entered"]
[connection signal="triggerActiveSignal" from="Area2D" to="." method="_on_triggerSignal"]
+17
View File
@@ -0,0 +1,17 @@
[gd_scene format=3 uid="uid://dotmw0uwnqv6w"]
[ext_resource type="Script" uid="uid://bd8br3emm1nhb" path="res://Scripts/grenade.gd" id="1_v44n1"]
[sub_resource type="CircleShape2D" id="CircleShape2D_b5j7x"]
radius = 5.0
[node name="Grenade" type="RigidBody2D" unique_id=638454305]
contact_monitor = true
max_contacts_reported = 3
script = ExtResource("1_v44n1")
[node name="CollisionShape2D" type="CollisionShape2D" parent="." unique_id=1542775089]
shape = SubResource("CircleShape2D_b5j7x")
debug_color = Color(0.81554836, 0.40704176, 0.03861203, 0.41960785)
[connection signal="body_entered" from="." to="." method="_on_body_entered"]
+156
View File
@@ -1,9 +1,150 @@
[gd_scene format=3 uid="uid://caa73phf3ng5m"]
[ext_resource type="Script" uid="uid://btmoyp0rwqmxe" path="res://Scripts/player.gd" id="1_v0iea"]
[ext_resource type="Texture2D" uid="uid://dlax6d4nhkl4p" path="res://assets/graphics/player/idle/Player Idle 48x48.png" id="2_cvnsp"]
[ext_resource type="Texture2D" uid="uid://bc251ptp8ujsv" path="res://assets/graphics/player/run/player run 48x48.png" id="3_6t5aa"]
[sub_resource type="CircleShape2D" id="CircleShape2D_2poj3"]
[sub_resource type="AtlasTexture" id="AtlasTexture_6t5aa"]
atlas = ExtResource("2_cvnsp")
region = Rect2(0, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_vgqql"]
atlas = ExtResource("2_cvnsp")
region = Rect2(48, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_fkybt"]
atlas = ExtResource("2_cvnsp")
region = Rect2(96, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_x3wgy"]
atlas = ExtResource("2_cvnsp")
region = Rect2(144, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_3smsa"]
atlas = ExtResource("2_cvnsp")
region = Rect2(192, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_8erm5"]
atlas = ExtResource("2_cvnsp")
region = Rect2(240, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_f1ek2"]
atlas = ExtResource("2_cvnsp")
region = Rect2(288, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_tx1dd"]
atlas = ExtResource("2_cvnsp")
region = Rect2(336, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_gymyn"]
atlas = ExtResource("2_cvnsp")
region = Rect2(384, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_pu2lt"]
atlas = ExtResource("2_cvnsp")
region = Rect2(432, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_ukyrk"]
atlas = ExtResource("3_6t5aa")
region = Rect2(0, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_7dp3o"]
atlas = ExtResource("3_6t5aa")
region = Rect2(48, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_h4iuc"]
atlas = ExtResource("3_6t5aa")
region = Rect2(96, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_fd4e3"]
atlas = ExtResource("3_6t5aa")
region = Rect2(144, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_qqcod"]
atlas = ExtResource("3_6t5aa")
region = Rect2(192, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_igrcy"]
atlas = ExtResource("3_6t5aa")
region = Rect2(240, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_fs7ks"]
atlas = ExtResource("3_6t5aa")
region = Rect2(288, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_l6n3p"]
atlas = ExtResource("3_6t5aa")
region = Rect2(336, 0, 48, 48)
[sub_resource type="SpriteFrames" id="SpriteFrames_ukyrk"]
animations = [{
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_6t5aa")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_vgqql")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_fkybt")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_x3wgy")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_3smsa")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_8erm5")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_f1ek2")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_tx1dd")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_gymyn")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_pu2lt")
}],
"loop": true,
"name": &"idle",
"speed": 12.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_ukyrk")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_7dp3o")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_h4iuc")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_fd4e3")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_qqcod")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_igrcy")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_fs7ks")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_l6n3p")
}],
"loop": true,
"name": &"run",
"speed": 12.0
}]
[node name="Player" type="CharacterBody2D" unique_id=1717313761]
script = ExtResource("1_v0iea")
metadata/_edit_group_ = true
@@ -17,3 +158,18 @@ target_position = Vector2(17, 0)
[node name="LeftCast" type="RayCast2D" parent="." unique_id=839132816]
target_position = Vector2(-17, 0)
[node name="RightSpawn" type="Marker2D" parent="." unique_id=1154451890]
position = Vector2(13, -8)
[node name="LeftSpawn" type="Marker2D" parent="." unique_id=52406940]
position = Vector2(-14, -8)
[node name="PlayerGraphic" type="AnimatedSprite2D" parent="." unique_id=149398795]
texture_filter = 1
position = Vector2(0, -6)
sprite_frames = SubResource("SpriteFrames_ukyrk")
animation = &"run"
autoplay = "idle"
frame = 5
frame_progress = 0.17384599