From 42e68814539182e596a9cc1544ad082a33387f9b Mon Sep 17 00:00:00 2001 From: Ultrablob Date: Thu, 6 Feb 2025 14:49:13 -0500 Subject: [PATCH] add new waves for real --- Entagon.gd | 2 +- Spawner.gd | 2 +- bullet.gd | 1 + bullet.tscn | 24 ++++++++++++++++-------- eart.tres | 2 +- entagon.tscn | 3 +++ entagon_enemy.tres | 2 +- eptagon.tscn | 3 +++ main.gd | 2 +- main.tscn | 33 +++++++++++++++++++++++++++++---- shield.gd | 21 +++++++++++++++++++++ shield.tscn | 4 ++-- 12 files changed, 80 insertions(+), 19 deletions(-) create mode 100644 shield.gd diff --git a/Entagon.gd b/Entagon.gd index c916b00..9ddafe9 100644 --- a/Entagon.gd +++ b/Entagon.gd @@ -8,7 +8,7 @@ func hit(body): body.destroy() else: body.queue_free() - spawn_explosion() + spawn_explosion() queue_free() if body.name == "Border": queue_free() diff --git a/Spawner.gd b/Spawner.gd index 59af8f7..560e264 100644 --- a/Spawner.gd +++ b/Spawner.gd @@ -56,7 +56,7 @@ func spawn(item: WaveEnemy): print("Spawning Boss!") spawn_loc = Vector2(1920/2, 1080/2) else: - for i in range(100): + for i in range(1000): var test_pos = Vector2(randf(), randf()) * Vector2(1920, 1080) if not $"../CollisionCheck".is_clear(test_pos, item.check_distance): continue diff --git a/bullet.gd b/bullet.gd index 6b54bf3..8f3a48f 100644 --- a/bullet.gd +++ b/bullet.gd @@ -21,6 +21,7 @@ func hit(body): queue_free() else: bounces += 1 + $Sprite2D.play("depleted") #print(bounces) if bounces >= 2: diff --git a/bullet.tscn b/bullet.tscn index 2398538..8af497f 100644 --- a/bullet.tscn +++ b/bullet.tscn @@ -20,11 +20,11 @@ region = Rect2(0, 0, 40, 40) atlas = ExtResource("2_unua3") region = Rect2(40, 0, 40, 40) -[sub_resource type="AtlasTexture" id="AtlasTexture_u3ov1"] +[sub_resource type="AtlasTexture" id="AtlasTexture_m7c0a"] atlas = ExtResource("2_unua3") region = Rect2(80, 0, 40, 40) -[sub_resource type="AtlasTexture" id="AtlasTexture_ia1sw"] +[sub_resource type="AtlasTexture" id="AtlasTexture_uq6kd"] atlas = ExtResource("2_unua3") region = Rect2(120, 0, 40, 40) @@ -36,16 +36,21 @@ animations = [{ }, { "duration": 1.0, "texture": SubResource("AtlasTexture_ldqff") -}, { -"duration": 1.0, -"texture": SubResource("AtlasTexture_u3ov1") -}, { -"duration": 1.0, -"texture": SubResource("AtlasTexture_ia1sw") }], "loop": true, "name": &"default", "speed": 7.0 +}, { +"frames": [{ +"duration": 1.0, +"texture": SubResource("AtlasTexture_m7c0a") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_uq6kd") +}], +"loop": true, +"name": &"depleted", +"speed": 5.0 }] [sub_resource type="CircleShape2D" id="CircleShape2D_13gk7"] @@ -70,7 +75,10 @@ position = Vector2(-0.0234375, -0.00781251) rotation = 1.5708 scale = Vector2(4, 4) sprite_frames = SubResource("SpriteFrames_pacu6") +animation = &"depleted" autoplay = "default" +frame = 1 +frame_progress = 0.323082 offset = Vector2(7.05637, 10.7826) [node name="TrajectoryDisplay" type="Line2D" parent="."] diff --git a/eart.tres b/eart.tres index 886e17f..ba101e4 100644 --- a/eart.tres +++ b/eart.tres @@ -9,4 +9,4 @@ script = ExtResource("1_0iu7m") enemy = ExtResource("1_hy2xe") boss = false portal_texture = ExtResource("2_nxpif") -check_distance = 100 +check_distance = 150 diff --git a/entagon.tscn b/entagon.tscn index 8690ab3..139d3ce 100644 --- a/entagon.tscn +++ b/entagon.tscn @@ -100,4 +100,7 @@ target_shield = true shape = SubResource("CircleShape2D_eo18f") target_position = Vector2(2.08165e-12, 500) +[node name="ShieldMarker" type="Marker2D" parent="."] +scale = Vector2(1.5, 1.5) + [connection signal="body_entered" from="." to="." method="hit"] diff --git a/entagon_enemy.tres b/entagon_enemy.tres index a1d3fbc..bae3c74 100644 --- a/entagon_enemy.tres +++ b/entagon_enemy.tres @@ -9,4 +9,4 @@ script = ExtResource("3_t4kaf") enemy = ExtResource("1_mfudl") boss = false portal_texture = ExtResource("2_2xm8e") -check_distance = 250 +check_distance = 200 diff --git a/eptagon.tscn b/eptagon.tscn index 233b17b..945adf6 100644 --- a/eptagon.tscn +++ b/eptagon.tscn @@ -64,4 +64,7 @@ bullet = ExtResource("4_cyd7j") [node name="Collider" type="CollisionShape2D" parent="."] shape = SubResource("CircleShape2D_03ifk") +[node name="ShieldMarker" type="Marker2D" parent="."] +scale = Vector2(2, 2) + [connection signal="animation_looped" from="Turret/AnimatedSprite2D" to="Turret/Gun" method="shoot"] diff --git a/main.gd b/main.gd index 7baf6c7..11e4902 100644 --- a/main.gd +++ b/main.gd @@ -5,7 +5,7 @@ var config = ConfigFile.new() func _init(): if OS.is_debug_build(): - Engine.set_time_scale(1) + Engine.set_time_scale(0.75) if config.load("user://settings.cfg") == OK: var player = load(config.get_value("gameplay", "class", "res://player-row.tscn")).instantiate() diff --git a/main.tscn b/main.tscn index 42edd15..74e1879 100644 --- a/main.tscn +++ b/main.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=117 format=3 uid="uid://bmd4m7lqj4v0x"] +[gd_scene load_steps=120 format=3 uid="uid://bmd4m7lqj4v0x"] [ext_resource type="Script" path="res://main.gd" id="1_3dydx"] [ext_resource type="Script" path="res://Spawner.gd" id="1_ifu8g"] @@ -129,12 +129,36 @@ wait_for_killed = true [sub_resource type="Resource" id="Resource_2j32b"] script = ExtResource("4_um0x7") -enemies = Array[ExtResource("7_54h7d")]([ExtResource("5_xdrk0"), ExtResource("9_q67ak")]) -quantities = Array[int]([2, 2]) +enemies = Array[ExtResource("7_54h7d")]([ExtResource("5_xdrk0"), ExtResource("9_q67ak"), ExtResource("10_jib8h")]) +quantities = Array[int]([2, 2, 1]) spawning_duration = 10.0 wait = 3.0 wait_for_killed = true +[sub_resource type="Resource" id="Resource_viqo8"] +script = ExtResource("4_um0x7") +enemies = Array[ExtResource("7_54h7d")]([ExtResource("5_xdrk0"), ExtResource("9_q67ak"), ExtResource("10_jib8h")]) +quantities = Array[int]([15, 3, 4]) +spawning_duration = 30.0 +wait = 10.0 +wait_for_killed = true + +[sub_resource type="Resource" id="Resource_o3j5s"] +script = ExtResource("4_um0x7") +enemies = Array[ExtResource("7_54h7d")]([ExtResource("5_e24vf"), ExtResource("3_xmk5u"), ExtResource("10_jib8h")]) +quantities = Array[int]([5, 5, 3]) +spawning_duration = 20.0 +wait = 5.0 +wait_for_killed = true + +[sub_resource type="Resource" id="Resource_cygv1"] +script = ExtResource("4_um0x7") +enemies = Array[ExtResource("7_54h7d")]([ExtResource("5_e24vf"), ExtResource("10_jib8h"), ExtResource("3_xmk5u"), ExtResource("5_xdrk0"), ExtResource("9_q67ak")]) +quantities = Array[int]([5, 5, 10, 15, 5]) +spawning_duration = 30.0 +wait = 1.0 +wait_for_killed = true + [sub_resource type="RectangleShape2D" id="RectangleShape2D_7w8g6"] size = Vector2(328, 185.333) @@ -668,8 +692,9 @@ script = ExtResource("1_3dydx") [node name="Spawner" type="Node2D" parent="." node_paths=PackedStringArray("wave_label")] script = ExtResource("1_ifu8g") -waves = Array[ExtResource("4_um0x7")]([SubResource("Resource_ur7l5"), SubResource("Resource_kupyp"), SubResource("Resource_o8cet"), SubResource("Resource_0cevq"), SubResource("Resource_eppj0"), SubResource("Resource_rpu1y"), SubResource("Resource_4b1vo"), SubResource("Resource_gg7kj"), SubResource("Resource_fjkob"), SubResource("Resource_5sdy5"), SubResource("Resource_61v84"), SubResource("Resource_82qld"), SubResource("Resource_2j32b")]) +waves = Array[ExtResource("4_um0x7")]([SubResource("Resource_ur7l5"), SubResource("Resource_kupyp"), SubResource("Resource_o8cet"), SubResource("Resource_0cevq"), SubResource("Resource_eppj0"), SubResource("Resource_rpu1y"), SubResource("Resource_4b1vo"), SubResource("Resource_gg7kj"), SubResource("Resource_fjkob"), SubResource("Resource_5sdy5"), SubResource("Resource_61v84"), SubResource("Resource_82qld"), SubResource("Resource_2j32b"), SubResource("Resource_viqo8"), SubResource("Resource_o3j5s"), SubResource("Resource_cygv1")]) wave_label = NodePath("../UI/Wave Count") +start_wave = 15 [node name="Timer" type="Timer" parent="Spawner"] wait_time = 0.1 diff --git a/shield.gd b/shield.gd new file mode 100644 index 0000000..18aa90d --- /dev/null +++ b/shield.gd @@ -0,0 +1,21 @@ +extends PhysicsBody2D + +#! egregious code + +func find_collisionshape(): + if get_parent().name == "ShieldMarker": + return get_parent().get_parent().get_node("CollisionShape2D") + elif get_parent().has_node("CollisionShape2D"): + return get_parent().get_node("CollisionShape2D") + return null + +func _ready() -> void: + if find_collisionshape(): + print(find_collisionshape().get_parent().name) + find_collisionshape().set_deferred("disabled", true) + $Collider.set_deferred("disabled", false) + +func destroy(): + if find_collisionshape(): + find_collisionshape().set_deferred("disabled", false) + $AnimatedSprite2D.play("die") diff --git a/shield.tscn b/shield.tscn index 9524d4d..7edd12e 100644 --- a/shield.tscn +++ b/shield.tscn @@ -1,6 +1,6 @@ [gd_scene load_steps=19 format=3 uid="uid://c3s8as813frjc"] -[ext_resource type="Script" path="res://shield.gd" id="1_ni0ln"] +[ext_resource type="Script" path="res://shield.gd" id="1_v4v4e"] [ext_resource type="Texture2D" uid="uid://cc3nl13t7c4mj" path="res://eart-shield.png" id="2_2bt8h"] [ext_resource type="Texture2D" uid="uid://dysewmpj8nvgx" path="res://eart-shield-break.png" id="3_1tta6"] @@ -113,7 +113,7 @@ radius = 25.1794 [node name="Shield" type="StaticBody2D" groups=["destructible"]] scale = Vector2(3.5, 3.5) -script = ExtResource("1_ni0ln") +script = ExtResource("1_v4v4e") [node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."] sprite_frames = SubResource("SpriteFrames_gcmwu")