bullet factory, object pooling, state machine, animations, NPC

This commit is contained in:
torontocaper committed 2026-03-16 20:58:33 -04:00
1 parent 3bf7da43e3
commit 75d4918c45
18 files changed
+480 -25

No files matched your search

+2
View File
@@ -11,3 +11,5 @@ script = ExtResource("1_mkf8s")
scale = Vector2(0.47999987, 8.651428)
shape = SubResource("RectangleShape2D_h1aey")
debug_color = Color(1, 0, 0, 1)
[connection signal="body_entered" from="." to="." method="_on_body_entered"]
+5 -1
View File
@@ -5,6 +5,7 @@
[ext_resource type="PackedScene" uid="uid://xvv1nyl3ny2g" path="res://scenes/crate.tscn" id="2_lnu2h"]
[ext_resource type="PackedScene" uid="uid://dyxqdgvctjshx" path="res://scenes/player.tscn" id="3_iywne"]
[ext_resource type="PackedScene" uid="uid://c7i6hsic2uojx" path="res://scenes/trigger.tscn" id="4_lbhrr"]
[ext_resource type="PackedScene" uid="uid://bmkh4wsfm3fbq" path="res://scenes/npc_charector.tscn" id="6_p57ef"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_8cj0n"]
size = Vector2(74, 20)
@@ -44,7 +45,7 @@ position = Vector2(644, 404)
position = Vector2(609, 403)
[node name="Crate3" parent="Crates" unique_id=1771442258 instance=ExtResource("2_lnu2h")]
position = Vector2(506, 353.99994)
position = Vector2(585.99994, 378.99997)
[node name="Level" type="Node2D" parent="." unique_id=219661874]
@@ -62,3 +63,6 @@ metadata/_edit_group_ = true
[node name="CollisionShape2D" type="CollisionShape2D" parent="Level/Floor" unique_id=895098891]
shape = SubResource("WorldBoundaryShape2D_lbhrr")
[node name="NPCCharector" parent="." unique_id=912777798 instance=ExtResource("6_p57ef")]
position = Vector2(460, 422)
+12
View File
@@ -0,0 +1,12 @@
[gd_scene format=3 uid="uid://bmkh4wsfm3fbq"]
[ext_resource type="Script" uid="uid://cj5rps4p0rgja" path="res://scripts/npc_charector.gd" id="1_r6gjy"]
[sub_resource type="CircleShape2D" id="CircleShape2D_loa6c"]
[node name="NPCCharector" type="CharacterBody2D" unique_id=912777798]
script = ExtResource("1_r6gjy")
[node name="CollisionShape2D" type="CollisionShape2D" parent="." unique_id=1840833487]
shape = SubResource("CircleShape2D_loa6c")
debug_color = Color(0.9623242, 2.0214916e-06, 0.5080306, 0.41960785)
+183 -1
View File
@@ -1,12 +1,184 @@
[gd_scene format=3 uid="uid://dyxqdgvctjshx"]
[ext_resource type="Script" uid="uid://ctm4xm3lnquco" path="res://scripts/player.gd" id="1_3vyb7"]
[ext_resource type="Texture2D" uid="uid://cvcfc7qj6sxfp" path="res://assets/graphics/player/jump_fall/player jump 48x48.png" id="2_dqkch"]
[ext_resource type="Texture2D" uid="uid://cy1khw337wx4h" path="res://assets/graphics/player/idle/Player Idle 48x48(1).png" id="2_g2els"]
[ext_resource type="Texture2D" uid="uid://cvs62nydereyb" path="res://assets/graphics/player/running/player run 48x48(1).png" id="3_qhqgy"]
[sub_resource type="CircleShape2D" id="CircleShape2D_uwrxv"]
[sub_resource type="AtlasTexture" id="AtlasTexture_i4ail"]
atlas = ExtResource("2_dqkch")
region = Rect2(96, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_qhqgy"]
atlas = ExtResource("2_g2els")
region = Rect2(0, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_dqkch"]
atlas = ExtResource("2_g2els")
region = Rect2(48, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_qlg0r"]
atlas = ExtResource("2_g2els")
region = Rect2(96, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_tuyoq"]
atlas = ExtResource("2_g2els")
region = Rect2(144, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_fjrip"]
atlas = ExtResource("2_g2els")
region = Rect2(192, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_smehm"]
atlas = ExtResource("2_g2els")
region = Rect2(240, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_ur7pv"]
atlas = ExtResource("2_g2els")
region = Rect2(288, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_y4r1p"]
atlas = ExtResource("2_g2els")
region = Rect2(336, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_d2wvv"]
atlas = ExtResource("2_g2els")
region = Rect2(384, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_3v2ag"]
atlas = ExtResource("2_g2els")
region = Rect2(432, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_a38lo"]
atlas = ExtResource("2_dqkch")
region = Rect2(0, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_4ni07"]
atlas = ExtResource("2_dqkch")
region = Rect2(48, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_jej6c"]
atlas = ExtResource("3_qhqgy")
region = Rect2(0, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_f1ej7"]
atlas = ExtResource("3_qhqgy")
region = Rect2(48, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_oprun"]
atlas = ExtResource("3_qhqgy")
region = Rect2(96, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_a8ls1"]
atlas = ExtResource("3_qhqgy")
region = Rect2(144, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_qfm1y"]
atlas = ExtResource("3_qhqgy")
region = Rect2(192, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_fulsm"]
atlas = ExtResource("3_qhqgy")
region = Rect2(240, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_4r5pv"]
atlas = ExtResource("3_qhqgy")
region = Rect2(288, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_60mlk"]
atlas = ExtResource("3_qhqgy")
region = Rect2(336, 0, 48, 48)
[sub_resource type="SpriteFrames" id="SpriteFrames_jej6c"]
animations = [{
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_i4ail")
}],
"loop": false,
"name": &"falling",
"speed": 12.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_qhqgy")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_dqkch")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_qlg0r")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_tuyoq")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_fjrip")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_smehm")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_ur7pv")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_y4r1p")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_d2wvv")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_3v2ag")
}],
"loop": true,
"name": &"idle",
"speed": 12.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_a38lo")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_4ni07")
}],
"loop": false,
"name": &"jumping",
"speed": 12.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_jej6c")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_f1ej7")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_oprun")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_a8ls1")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_qfm1y")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_fulsm")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_4r5pv")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_60mlk")
}],
"loop": true,
"name": &"running",
"speed": 12.0
}]
[node name="Player" type="CharacterBody2D" unique_id=401513938]
script = ExtResource("1_3vyb7")
metadata/_edit_group_ = true
[node name="CollisionShape2D" type="CollisionShape2D" parent="." unique_id=31138863]
shape = SubResource("CircleShape2D_uwrxv")
@@ -17,3 +189,13 @@ position = Vector2(15, -3)
[node name="Left Gun" type="Marker2D" parent="." unique_id=1828444534]
position = Vector2(-15, -3)
[node name="PlayerGraphic" type="AnimatedSprite2D" parent="." unique_id=2124252059]
texture_filter = 1
position = Vector2(0, -10)
sprite_frames = SubResource("SpriteFrames_jej6c")
animation = &"falling"
autoplay = "idle"
frame_progress = 1.0
[connection signal="animation_finished" from="PlayerGraphic" to="." method="_on_animation_finished"]