Updated mirror wave; tweaked CRT movement

This commit is contained in:
Henry 2026-02-27 01:05:55 +00:00
parent 7e75a96795
commit 78472ee95c
28 changed files with 938 additions and 32 deletions

View file

@ -22,22 +22,38 @@ func _on_area_entered(area: Area2D) -> void:
var enemies = get_tree().get_nodes_in_group("enemies")
for enemy in enemies:
match enemy.enemy_type:
"crt":
if area.is_in_group("enemies"):
if enemy.vulnerable == true:
area.explode()
queue_free()
if enemy.vulnerable == false:
print("blocked!")
enemy.block()
#await bullet_fx()
queue_free()
match enemy.enemy_type:
"crt":
if area.is_in_group("enemies"):
if enemy.vulnerable == true:
area.hit_detection()
queue_free()
if enemy.vulnerable == false:
print("blocked!")
enemy.block()
#await bullet_fx()
queue_free()
_:
if area.is_in_group("enemies"):
area.explode()
queue_free()
"shards":
if area.is_in_group("shards"):
print("Shards hit!")
area.hit_detection()
"mirror":
if area.is_in_group("enemies"):
print("Mirror hit!")
area.hit_detection()
queue_free()
"chicken":
if area.is_in_group("enemies"):
print("Chicken hit!")
area.hit_detection()
queue_free()
#func bullet_fx():
#shader_active = true

View file

@ -45,7 +45,7 @@ func _process(delta):
start(start_pos)
func explode():
func hit_detection():
if exploding: return
exploding = true
EventBus.enemy_hit.emit(5)

View file

@ -24,7 +24,7 @@ const TILE = 32
@onready var screensize = get_viewport_rect().size
@onready var timer = $MoveTimer
@onready var crt = $EnemyCRT/CRT
@onready var crt = get_node("CRT")
func _ready():
timer.start()
@ -50,7 +50,7 @@ func _on_timer_timeout():
$DirectionTimer.start()
func _on_direction_timer_timeout():
var move_direction = int(randf_range(0,2))
var move_direction = int(randf_range(0,3))
match move_direction:
0:
$CRT.frame = 0
@ -95,7 +95,7 @@ func _process(delta):
start(start_pos)
func explode():
func hit_detection():
if exploding: return
exploding = true
EventBus.enemy_hit.emit(5)

27
scenes/enemy_mirror.gd Normal file
View file

@ -0,0 +1,27 @@
extends Node2D
#var enemy_type: String = "mirror"
var tween_speed: float = 1.4
var start_pos = Vector2.ZERO
var exploding = false
var health: int = 3
@onready var screensize = get_viewport_rect().size
@onready var sink_player = $EnemyMirror/AnimationPlayer
func _ready() -> void:
start_all_animations()
func start(pos):
position = Vector2(pos.x, -pos.y)
start_pos = pos
var tween = create_tween().set_trans(Tween.TRANS_BACK)
tween.tween_property(self, "position:y", start_pos.y, tween_speed)
func start_all_animations():
for child in get_children():
if child is AnimationPlayer:
child.play("patrol")

View file

@ -0,0 +1 @@
uid://dp8e0btv8lktd

84
scenes/enemy_mirror.tscn Normal file
View file

@ -0,0 +1,84 @@
[gd_scene format=3 uid="uid://cr72q4uij4dee"]
[ext_resource type="Script" uid="uid://dp8e0btv8lktd" path="res://scenes/enemy_mirror.gd" id="1_ucqiy"]
[ext_resource type="Script" uid="uid://dno2nntxrik2j" path="res://scenes/sink.gd" id="2_alyar"]
[ext_resource type="Texture2D" uid="uid://bs5540jcnaf7o" path="res://sprites/sink_and_mirror.png" id="2_il73p"]
[ext_resource type="AudioStream" uid="uid://cbi5q575w1g1n" path="res://sounds/CRT_IMPACT.wav" id="4_alyar"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_tcthq"]
size = Vector2(26, 18)
[sub_resource type="Animation" id="Animation_515op"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("..:position")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Vector2(0, 0)]
}
[sub_resource type="Animation" id="Animation_52i7y"]
resource_name = "travel"
length = 8.0
loop_mode = 1
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("..:position")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 1.9666667, 4, 6.0333333, 8.033334),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1),
"update": 0,
"values": [Vector2(0, 0), Vector2(88, 0), Vector2(0, 0), Vector2(-88, 0), Vector2(0, 0)]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_uxg4c"]
_data = {
&"RESET": SubResource("Animation_515op"),
&"travel": SubResource("Animation_52i7y")
}
[node name="EnemyMirror" type="Node2D" unique_id=1897558241]
z_index = -1
script = ExtResource("1_ucqiy")
[node name="Sink" type="Area2D" parent="." unique_id=767161856 groups=["enemies"]]
script = ExtResource("2_alyar")
[node name="Sprite" type="Sprite2D" parent="Sink" unique_id=1825839263]
texture = ExtResource("2_il73p")
hframes = 4
region_enabled = true
region_rect = Rect2(0, 0, 128, 36)
[node name="CollisionShape2D" type="CollisionShape2D" parent="Sink" unique_id=251481492]
position = Vector2(0, -7)
shape = SubResource("RectangleShape2D_tcthq")
[node name="AnimationPlayer" type="AnimationPlayer" parent="Sink" unique_id=1288483812]
root_node = NodePath("../Sprite")
libraries/ = SubResource("AnimationLibrary_uxg4c")
autoplay = &"travel"
[node name="ImpactSound" type="AudioStreamPlayer2D" parent="Sink" unique_id=227261011]
stream = ExtResource("4_alyar")
[node name="SinkMarkers" type="Node2D" parent="." unique_id=527549021]
[node name="Marker2D" type="Marker2D" parent="SinkMarkers" unique_id=1345428527]
position = Vector2(88, 0)
[node name="Marker2D2" type="Marker2D" parent="SinkMarkers" unique_id=1724416493]
position = Vector2(-88, 0)
[node name="Table" type="Node2D" parent="." unique_id=128144371]
[node name="Top" type="Node2D" parent="Table" unique_id=1108085768]

19
scenes/enemy_shards.gd Normal file
View file

@ -0,0 +1,19 @@
extends Node2D
# var enemy_type: String = "shards"
func _ready() -> void:
print("Requesting Animations…")
start_all_animations()
func start_all_animations():
var all_children = get_children(true)
for child in all_children:
#print(all_children)
print("Looking for AnimationPlayers…")
if child is AnimationPlayer:
print("Found an AnimationPlayer!")
child.play("patrol")
elif child != AnimationPlayer: print("No animation players found!")

View file

@ -0,0 +1 @@
uid://bbtafofyupffs

435
scenes/enemy_shards.tscn Normal file
View file

@ -0,0 +1,435 @@
[gd_scene format=3 uid="uid://j7gmlgd0dgn"]
[ext_resource type="Texture2D" uid="uid://dik51qdl4ixco" path="res://sprites/glass_shards_packed.png" id="1_6ro5i"]
[ext_resource type="Script" uid="uid://bbtafofyupffs" path="res://scenes/enemy_shards.gd" id="1_yu0xq"]
[ext_resource type="Script" uid="uid://whayoa6gwn0u" path="res://scenes/shards.gd" id="2_1se2b"]
[ext_resource type="Shader" uid="uid://x02irwg8ynvp" path="res://shaders/pixel_highlight.gdshader" id="3_bw53u"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_l2u7i"]
shader = ExtResource("3_bw53u")
shader_parameter/speed = 1.0
shader_parameter/line_width = 0.15
shader_parameter/line_color = Color(1, 1, 1, 1)
shader_parameter/pause_duration = 0.15
shader_parameter/offset = 2.0
shader_parameter/pixelate_line = 1
[sub_resource type="Animation" id="Animation_6ro5i"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:position")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Vector2(27, -48)]
}
[sub_resource type="Animation" id="Animation_yu0xq"]
resource_name = "patrol"
length = 2.0
loop_mode = 2
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:position")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0.033333335, 2),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [Vector2(27, -48), Vector2(105.333336, -130.66667)]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_1se2b"]
_data = {
&"RESET": SubResource("Animation_6ro5i"),
&"patrol": SubResource("Animation_yu0xq")
}
[sub_resource type="ShaderMaterial" id="ShaderMaterial_bnwne"]
shader = ExtResource("3_bw53u")
shader_parameter/speed = 1.0
shader_parameter/line_width = 0.15
shader_parameter/line_color = Color(1, 1, 1, 1)
shader_parameter/pause_duration = 0.15
shader_parameter/offset = 2.0
shader_parameter/pixelate_line = 1
[sub_resource type="Animation" id="Animation_bw53u"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:position")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Vector2(-14.666667, -36)]
}
[sub_resource type="Animation" id="Animation_l2u7i"]
resource_name = "patrol"
length = 4.0
loop_mode = 2
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:position")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 3.8333333, 3.9666667),
"transitions": PackedFloat32Array(1, 1, 1),
"update": 0,
"values": [Vector2(-14.666667, -36), Vector2(-40, -58.666668), Vector2(-85.333336, -90.66667)]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_bnwne"]
_data = {
&"RESET": SubResource("Animation_bw53u"),
&"patrol": SubResource("Animation_l2u7i")
}
[sub_resource type="Animation" id="Animation_3jlmk"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:position")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Vector2(-24, -14)]
}
[sub_resource type="Animation" id="Animation_n0ncd"]
resource_name = "patrol"
length = 2.0
loop_mode = 2
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:position")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 1.9666667),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [Vector2(-24, -14), Vector2(-124, -14)]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_8olg8"]
_data = {
&"RESET": SubResource("Animation_3jlmk"),
&"patrol": SubResource("Animation_n0ncd")
}
[sub_resource type="Animation" id="Animation_ul3we"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:position")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Vector2(27, -19)]
}
[sub_resource type="Animation" id="Animation_4y33j"]
resource_name = "patrol"
length = 1.5
loop_mode = 2
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:position")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 1.5),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [Vector2(27, -19), Vector2(122.66667, -19)]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_awbo5"]
_data = {
&"RESET": SubResource("Animation_ul3we"),
&"patrol": SubResource("Animation_4y33j")
}
[sub_resource type="Animation" id="Animation_7s70c"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:position")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Vector2(-1, 14)]
}
[sub_resource type="Animation" id="Animation_sd7ug"]
resource_name = "patrol"
length = 2.0
loop_mode = 2
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:position")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 2),
"transitions": PackedFloat32Array(0.25000003, 2.143551),
"update": 0,
"values": [Vector2(-1, 14), Vector2(-72, 34.666668)]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_dmrvj"]
_data = {
&"RESET": SubResource("Animation_7s70c"),
&"patrol": SubResource("Animation_sd7ug")
}
[sub_resource type="Animation" id="Animation_c6ehs"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:position")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Vector2(16, 37)]
}
[sub_resource type="Animation" id="Animation_ieuki"]
resource_name = "patrol"
length = 2.75
loop_mode = 2
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:position")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0.033333335, 2.7333333),
"transitions": PackedFloat32Array(0.24999996, 1),
"update": 0,
"values": [Vector2(16, 37), Vector2(76, 21.333332)]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_bg1f8"]
_data = {
&"RESET": SubResource("Animation_c6ehs"),
&"patrol": SubResource("Animation_ieuki")
}
[sub_resource type="Animation" id="Animation_rsb42"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:position")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Vector2(-18, 40)]
}
[sub_resource type="Animation" id="Animation_ee5xp"]
resource_name = "patrol"
length = 3.0
loop_mode = 2
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:position")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 2.9666667),
"transitions": PackedFloat32Array(0.4061259, 0.20306315),
"update": 0,
"values": [Vector2(-18, 40), Vector2(-52, 73.333336)]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_a2ego"]
_data = {
&"RESET": SubResource("Animation_rsb42"),
&"patrol": SubResource("Animation_ee5xp")
}
[node name="EnemyShards" type="Node2D" unique_id=288811575]
visible = false
scale = Vector2(0.75, 0.75)
script = ExtResource("1_yu0xq")
[node name="Shard 7a" type="Area2D" parent="." unique_id=2082596482 groups=["enemies", "shards"]]
position = Vector2(27, -48)
script = ExtResource("2_1se2b")
[node name="Sprite2D" type="Sprite2D" parent="Shard 7a" unique_id=1293357619]
material = SubResource("ShaderMaterial_l2u7i")
texture = ExtResource("1_6ro5i")
region_enabled = true
region_rect = Rect2(236, 0, 38, 36)
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="Shard 7a" unique_id=901900924]
position = Vector2(-0.33333302, 0)
scale = Vector2(0.9, 0.815)
polygon = PackedVector2Array(-17.333334, 17.333332, 16, -2.666668, 16, -16, -6.666668, -16)
[node name="AnimationPlayer" type="AnimationPlayer" parent="Shard 7a" unique_id=1249901448]
libraries/ = SubResource("AnimationLibrary_1se2b")
autoplay = &"patrol"
speed_scale = 0.768
[node name="Shard 6a" type="Area2D" parent="." unique_id=1610872105 groups=["enemies", "shards"]]
position = Vector2(-14.666667, -36)
script = ExtResource("2_1se2b")
[node name="Sprite2D" type="Sprite2D" parent="Shard 6a" unique_id=1377882733]
material = SubResource("ShaderMaterial_bnwne")
position = Vector2(0, -2)
texture = ExtResource("1_6ro5i")
region_enabled = true
region_rect = Rect2(94, 0, 70, 56)
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="Shard 6a" unique_id=910049206]
position = Vector2(-9.333335, -8.000001)
scale = Vector2(0.9, 0.815)
polygon = PackedVector2Array(0, 15.873028, 17.240612, 26.455048, 31.607788, -15.873032, -17.240612, -15.873032, -17.240612, 5.291008)
[node name="AnimationPlayer" type="AnimationPlayer" parent="Shard 6a" unique_id=6479119]
libraries/ = SubResource("AnimationLibrary_bnwne")
autoplay = &"patrol"
speed_scale = 0.768
[node name="Shard 5a" type="Area2D" parent="." unique_id=1066911643 groups=["enemies", "shards"]]
position = Vector2(-24, -14)
script = ExtResource("2_1se2b")
[node name="Sprite2D" type="Sprite2D" parent="Shard 5a" unique_id=586563828]
material = SubResource("ShaderMaterial_l2u7i")
texture = ExtResource("1_6ro5i")
region_enabled = true
region_rect = Rect2(226, 48, 48, 40)
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="Shard 5a" unique_id=1528118020]
position = Vector2(-8, -2)
scale = Vector2(0.9, 0.815)
polygon = PackedVector2Array(-14.666668, -16, -14.666668, 20, 32, 8)
[node name="AnimationPlayer" type="AnimationPlayer" parent="Shard 5a" unique_id=419906886]
libraries/ = SubResource("AnimationLibrary_8olg8")
autoplay = &"patrol"
speed_scale = 0.768
[node name="Shard 4a" type="Area2D" parent="." unique_id=1400249441 groups=["enemies", "shards"]]
position = Vector2(27, -19)
script = ExtResource("2_1se2b")
[node name="Sprite2D" type="Sprite2D" parent="Shard 4a" unique_id=1098571076]
material = SubResource("ShaderMaterial_l2u7i")
texture = ExtResource("1_6ro5i")
region_enabled = true
region_rect = Rect2(0, 46, 54, 68)
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="Shard 4a" unique_id=138889232]
position = Vector2(5, -3.6666667)
scale = Vector2(0.9, 0.815)
polygon = PackedVector2Array(16, 16, 16, 36, -29.333334, 12.000001, -21.333332, -8, 14.666668, -28)
[node name="AnimationPlayer" type="AnimationPlayer" parent="Shard 4a" unique_id=2025454166]
libraries/ = SubResource("AnimationLibrary_awbo5")
autoplay = &"patrol"
speed_scale = 0.768
[node name="Shard 3a" type="Area2D" parent="." unique_id=1325375019 groups=["enemies", "shards"]]
position = Vector2(-1, 14)
script = ExtResource("2_1se2b")
[node name="Sprite2D" type="Sprite2D" parent="Shard 3a" unique_id=1177483202]
material = SubResource("ShaderMaterial_l2u7i")
texture = ExtResource("1_6ro5i")
region_enabled = true
region_rect = Rect2(0, 0, 93, 46)
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="Shard 3a" unique_id=1103906458]
scale = Vector2(0.9, 0.815)
polygon = PackedVector2Array(-20.333334, 20.666668, 43.666668, 2, 1, -22, -45.666668, -8.666666, -45.666668, 2, -20.333334, 20.666668)
[node name="AnimationPlayer" type="AnimationPlayer" parent="Shard 3a" unique_id=156197660]
libraries/ = SubResource("AnimationLibrary_dmrvj")
autoplay = &"patrol"
speed_scale = 0.768
[node name="Shard 2a" type="Area2D" parent="." unique_id=303720937 groups=["enemies", "shards"]]
position = Vector2(16, 37)
script = ExtResource("2_1se2b")
[node name="Sprite2D" type="Sprite2D" parent="Shard 2a" unique_id=699252441]
material = SubResource("ShaderMaterial_l2u7i")
position = Vector2(-2, 4)
texture = ExtResource("1_6ro5i")
region_enabled = true
region_rect = Rect2(166, 0, 68, 48)
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="Shard 2a" unique_id=1209273661]
position = Vector2(16, -1)
scale = Vector2(0.9, 0.815)
polygon = PackedVector2Array(17.333336, 17.333336, 17.333336, 28, -18.666666, 28, -49.333336, 1.3333359, 17.333336, -17.333332)
[node name="AnimationPlayer" type="AnimationPlayer" parent="Shard 2a" unique_id=791849802]
libraries/ = SubResource("AnimationLibrary_bg1f8")
autoplay = &"patrol"
speed_scale = 0.768
[node name="Shard 1a" type="Area2D" parent="." unique_id=1571154045 groups=["enemies", "shards"]]
position = Vector2(-18, 40)
script = ExtResource("2_1se2b")
[node name="Sprite2D" type="Sprite2D" parent="Shard 1a" unique_id=1796506745]
material = SubResource("ShaderMaterial_l2u7i")
texture = ExtResource("1_6ro5i")
region_enabled = true
region_rect = Rect2(164, 48, 62, 48)
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="Shard 1a" unique_id=1448077931]
position = Vector2(-12.666667, 8)
scale = Vector2(0.9, 0.815)
polygon = PackedVector2Array(-17.333332, 16, 42.666668, 17.333336, -16, -30.666666)
[node name="AnimationPlayer" type="AnimationPlayer" parent="Shard 1a" unique_id=455180039]
libraries/ = SubResource("AnimationLibrary_a2ego")
autoplay = &"patrol"

27
scenes/enemy_table.tscn Normal file
View file

@ -0,0 +1,27 @@
[gd_scene format=3 uid="uid://716kunhta8vk"]
[ext_resource type="Shader" uid="uid://x02irwg8ynvp" path="res://shaders/pixel_highlight.gdshader" id="1_d4l8f"]
[ext_resource type="Texture2D" uid="uid://cklakjbjislch" path="res://sprites/table.png" id="1_kcy6j"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_twce5"]
shader = ExtResource("1_d4l8f")
shader_parameter/speed = 1.0
shader_parameter/line_width = 0.15
shader_parameter/line_color = Color(1, 1, 1, 1)
shader_parameter/pause_duration = 0.15
shader_parameter/offset = 2.0
shader_parameter/pixelate_line = 1
[sub_resource type="RectangleShape2D" id="RectangleShape2D_d4l8f"]
size = Vector2(96, 128)
[node name="EnemyTable" type="Area2D" unique_id=1100011048]
scale = Vector2(0.75, 0.75)
[node name="Sprite2D" type="Sprite2D" parent="." unique_id=1791816654]
material = SubResource("ShaderMaterial_twce5")
texture = ExtResource("1_kcy6j")
hframes = 2
[node name="CollisionShape2D" type="CollisionShape2D" parent="." unique_id=982140641]
shape = SubResource("RectangleShape2D_d4l8f")

View file

@ -3,6 +3,7 @@ extends Node
@warning_ignore_start("unused_signal") # since otherwise Godot will throw a warning that the signal is unused in current scope
signal shield_changed(max_value: int, old_value: int, new_value: int)
signal set_shield(value: int)
signal player_died()
signal enemy_died()
signal enemy_hit(value: int)
@ -10,4 +11,7 @@ signal initialize_shieldbar()
signal start_game()
signal goose_talk(frame_index: int)
# FX
signal flash_screen(duration: float)
@warning_ignore_restore("unused_signal") # put any future signals you add between the two ignore annotations

View file

@ -25,6 +25,7 @@ func _ready():
EventBus.player_died.connect(_on_player_died)
#EventBus.enemy_died.connect(_on_enemy_died)
EventBus.enemy_hit.connect(_on_enemy_hit)
EventBus.flash_screen.connect(_on_flash_screen)
#func spawn_enemies():
@ -90,6 +91,7 @@ func new_game():
$CanvasLayer/Title.hide()
# Ensure enemies are cleared.
get_tree().call_group("enemies", "queue_free")
get_tree().call_group("shards", "queue_free")
get_tree().call_group("enemy_bullets", "queue_free")
# print("Number of enemies at new_game: ",enemy_count)
enemy_count = 0
@ -145,3 +147,15 @@ func win_game():
game_over.hide()
$CanvasLayer/Title.show()
start_button.show()
func _on_flash_screen(duration: float):
print("flash!")
$CanvasLayer/ColorRect.visible = true
await get_tree().create_timer(duration).timeout
#var tween = create_tween().set_parallel(false)
#tween.tween_property($CanvasLayer/ColorRect.material, "intensity", 1.0, duration)
#tween.set_ease(Tween.EASE_IN_OUT).tween_property($CanvasLayer/ColorRect.material, "intensity", 0.0, duration)
#await tween.finished
print("flash finished!")
$CanvasLayer/ColorRect.visible = false

View file

@ -8,6 +8,7 @@
[ext_resource type="Texture2D" uid="uid://bonoqs5pisflo" path="res://_graphics/Mini Pixel Pack 3/UI objects/START (48 x 8).png" id="5_lquwl"]
[ext_resource type="Texture2D" uid="uid://0mcbtnidp5kn" path="res://sprites/third space title.png" id="5_tipki"]
[ext_resource type="Texture2D" uid="uid://bubqwoum50gf8" path="res://_graphics/Mini Pixel Pack 3/UI objects/GAME_OVER (72 x 8).png" id="6_7mycd"]
[ext_resource type="Shader" uid="uid://blxo4qgrkjiup" path="res://shaders/flash.gdshader" id="8_eb6dy"]
[ext_resource type="PackedScene" uid="uid://cd1kwb8klcsb5" path="res://scenes/goose.tscn" id="9_85g3d"]
[ext_resource type="AudioStream" uid="uid://c3e8sdfqcikp6" path="res://sounds/welcome.wav" id="10_choun"]
[ext_resource type="PackedScene" uid="uid://drf1k1iulvy6f" path="res://scenes/wave.tscn" id="11_ya4ey"]
@ -59,6 +60,10 @@ shader_parameter/pause_duration = 6.0
shader_parameter/offset = 10.0
shader_parameter/pixelate_line = 0
[sub_resource type="ShaderMaterial" id="ShaderMaterial_trceg"]
shader = ExtResource("8_eb6dy")
shader_parameter/intensity = 1.0
[sub_resource type="ShaderMaterial" id="ShaderMaterial_5vw27"]
[node name="Main" type="Node2D" unique_id=128010797]
@ -103,6 +108,14 @@ texture_normal = ExtResource("5_lquwl")
layout_mode = 2
texture = ExtResource("6_7mycd")
[node name="ColorRect" type="ColorRect" parent="CanvasLayer" unique_id=18763245]
visible = false
material = SubResource("ShaderMaterial_trceg")
offset_right = 240.0
offset_bottom = 320.0
size_flags_horizontal = 3
size_flags_vertical = 3
[node name="background" type="Sprite2D" parent="." unique_id=1790434669]
visible = false
z_index = -4

View file

@ -10,7 +10,7 @@ signal damage_taken
@export var bullet_scene : PackedScene
@export var max_shield: int = 10
var shield: int = 0:
set = set_shield
set = _on_set_shield
var can_shoot = false
@ -31,6 +31,7 @@ var clamp_shield = clamp(shield, 0, max_shield)
func _ready():
set_process(false)
print(shield)
EventBus.set_shield.connect(_on_set_shield)
# start()
func start():
@ -45,7 +46,7 @@ func start():
tween.tween_property(self, "position:y", 120 * -1, 1).as_relative()
await tween.finished
$GunCooldown.wait_time = cooldown
set_shield(max_shield)
_on_set_shield(max_shield)
print(shield)
await get_tree().create_timer(1).timeout
set_process(true)
@ -85,7 +86,7 @@ func shoot():
tween.tween_property(ship, "position:y", 1, 0.1)
tween.tween_property(ship, "position:y", 0, 0.05)
func set_shield(value: int):
func _on_set_shield(value: int):
var old_value = shield
# shield = clamp(value, 0, max_shield)
shield = min(max_shield, value)
@ -116,10 +117,12 @@ func _on_area_entered(area):
if area.is_in_group("enemies"):
shield -= int(max_shield / 2)
# damage_taken.emit()
area.explode()
area.hit_detection()
if area.is_in_group("enemy_bullets") and self.monitoring == true:
damage_taken.emit()
if area.is_in_group("shards"):
shield -= int(max_shield / 2)
func _on_damage_taken():

17
scenes/shards.gd Normal file
View file

@ -0,0 +1,17 @@
extends Area2D
var enemy_type: String = "shards"
@onready var shard_player = $AnimationPlayer
@onready var child_node = get_node("Player")
func hit_detection():
print("Shift!")
#var tween = create_tween().set_parallel(true)
#tween.tween_property($Sprite, "position:y", 4, 0.1)
#tween.tween_property($Sprite, "position:y", 0, 0.05)
#await tween.finished
#EventBus.set_shield.emit(-1)
shard_player.pause()
await get_tree().create_timer(0.5).timeout
shard_player.play()

1
scenes/shards.gd.uid Normal file
View file

@ -0,0 +1 @@
uid://whayoa6gwn0u

74
scenes/sink.gd Normal file
View file

@ -0,0 +1,74 @@
extends Area2D
var enemy_type: String = "mirror"
var tween_speed: float = 1.4
var start_pos = Vector2.ZERO
var exploding = false
var health: int = 3
var pause: bool = false
@onready var screensize = get_viewport_rect().size
@onready var sink_player = $AnimationPlayer
@onready var impact_sound = $ImpactSound
func _ready() -> void:
sink_player.seek(randf_range(5, sink_player.current_animation_length))
EventBus.flash_screen.emit(0.15)
func start(pos):
position = Vector2(pos.x, -pos.y)
start_pos = pos
var tween = create_tween().set_trans(Tween.TRANS_BACK)
tween.tween_property(self, "position:y", start_pos.y, tween_speed)
#func _process(delta):
#if pause == true: return
func hit_detection():
if exploding: return
if health != 0:
health -= 1
EventBus.enemy_hit.emit(5)
var current_frame = get_node("Sprite").frame
impact_sound.play()
$Sprite.frame = current_frame + 1
#$AnimationPlayer.play("explode")
#set_deferred("monitoring", false)
#await $AnimationPlayer.animation_finished
var tween = create_tween().set_parallel(false)
tween.tween_property($Sprite, "position:y", -2, 0.1)
tween.tween_property($Sprite, "position:y", 0, 0.05)
await tween.finished
sink_player.pause()
await get_tree().create_timer(0.25).timeout
sink_player.play()
if health == 0:
exploding = true
impact_sound.play()
#await impact_sound.finished
#find all nodes in group "shards" and then queue_free.
var nodes = get_tree().get_nodes_in_group("shards")
for node in nodes:
node.queue_free()
EventBus.enemy_died.emit()
queue_free()
func explode():
if exploding: return
#exploding = true
EventBus.enemy_hit.emit(5)
hit_detection()
#$ImpactCRT.play()
#$AnimationPlayer.play("explode")
#set_deferred("monitoring", false)
#await $AnimationPlayer.animation_finished
#queue_free()
#EventBus.enemy_died.emit()

1
scenes/sink.gd.uid Normal file
View file

@ -0,0 +1 @@
uid://dno2nntxrik2j

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=7 format=3 uid="uid://s6wf3egdqtmh"]
[gd_scene format=3 uid="uid://s6wf3egdqtmh"]
[ext_resource type="Texture2D" uid="uid://d11molrkdjjh5" path="res://_graphics/bar_background.png" id="1_m6e0p"]
[ext_resource type="Script" uid="uid://b544c65halgk4" path="res://scenes/ui.gd" id="1_nltto"]
@ -10,7 +10,7 @@
shader = ExtResource("2_ibotj")
shader_parameter/toggle = 0.0
[node name="UI" type="MarginContainer"]
[node name="UI" type="MarginContainer" unique_id=722926975]
anchors_preset = 10
anchor_right = 1.0
offset_bottom = 20.0
@ -21,10 +21,10 @@ theme_override_constants/margin_right = 10
theme_override_constants/margin_bottom = 10
script = ExtResource("1_nltto")
[node name="HBoxContainer" type="HBoxContainer" parent="."]
[node name="HBoxContainer" type="HBoxContainer" parent="." unique_id=2065468078]
layout_mode = 2
[node name="ShieldBar" type="TextureProgressBar" parent="HBoxContainer"]
[node name="ShieldBar" type="TextureProgressBar" parent="HBoxContainer" unique_id=378017393]
material = SubResource("ShaderMaterial_n5ude")
custom_minimum_size = Vector2(80, 16)
layout_mode = 2
@ -37,7 +37,8 @@ stretch_margin_bottom = 3
texture_under = ExtResource("1_m6e0p")
texture_progress = ExtResource("2_27fn8")
[node name="ScoreCounter" parent="HBoxContainer" instance=ExtResource("4_ibotj")]
[node name="ScoreCounter" parent="HBoxContainer" unique_id=1107960341 instance=ExtResource("4_ibotj")]
visible = false
layout_mode = 2
[connection signal="value_changed" from="HBoxContainer/ShieldBar" to="." method="_on_shield_bar_value_changed"]

View file

@ -6,11 +6,16 @@ var enemy = null
@export var wave_complete: bool = false
@onready var screensize = get_viewport_rect().size
const COLS: int = 5
const ROWS: int = 3
const CHICKEN = preload("res://scenes/enemy_chicken.tscn")
const CRT = preload("res://scenes/enemy_CRT.tscn")
const MIRROR = preload("res://scenes/enemy_mirror.tscn")
const SHARDS = preload("res://scenes/enemy_shards.tscn")
const TABLE = preload("res://scenes/enemy_table.tscn")
func _ready():
wave_count = 0
@ -19,7 +24,7 @@ func _ready():
func spawn_enemies():
if wave_count == 1: #This is for CHICKENS
if wave_count == 2: #This is for CHICKENS
print("Enemy Wave: ", wave_count)
enemy = CHICKEN
for x in range(COLS):
@ -32,7 +37,7 @@ func spawn_enemies():
await get_tree().process_frame
print_debug("Remaining enemies: ", enemy_count, ", ", get_tree().get_nodes_in_group("enemies").size())
if wave_count == 0: #This is for CRTs
if wave_count == 1: #This is for CRTs
print("Enemy Wave: ", wave_count)
enemy = CRT
var cols_mod = COLS - 1
@ -47,6 +52,41 @@ func spawn_enemies():
enemy_count = rows_mod * cols_mod
await get_tree().process_frame
if wave_count == 0: #This if for Mirror
print("Enemy Wave: ", wave_count)
# Spawn Table
EventBus.flash_screen.emit(.25)
var t = TABLE.instantiate()
add_child(t)
t.position = Vector2(screensize.x / 2, position.y + 125)
await get_tree().create_timer(1.5).timeout
var ts = t.get_child(0)
ts.frame = 1
EventBus.flash_screen.emit(.25)
await get_tree().create_timer(1.5).timeout
# Spawn Mirror
enemy = MIRROR
enemy_count = 1
var e = enemy.instantiate()
add_child(e)
e.position = Vector2(screensize.x / 2, position.y + 48)
# Spawn Shards
t.queue_free()
var s = SHARDS.instantiate()
add_child(s)
s.position = Vector2(screensize.x / 2, position.y + 125)
s.show()
# Start Shards
await get_tree().create_timer(2)
s.start_all_animations()
func _on_enemy_died():
@ -65,7 +105,7 @@ func update_enemy_aggression(low,high):
func wave_status():
if enemy_count > 0:
enemy_aggression_check()
#enemy_aggression_check()
wave_complete = false
else:

7
shaders/flash.gdshader Normal file
View file

@ -0,0 +1,7 @@
shader_type canvas_item;
uniform float intensity : hint_range(0.0, 1.0) = 0.0;
void fragment() {
COLOR = vec4(1.0, 1.0, 1.0, intensity);
}

View file

@ -0,0 +1 @@
uid://blxo4qgrkjiup

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

View file

@ -0,0 +1,40 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://dik51qdl4ixco"
path="res://.godot/imported/glass_shards_packed.png-31578c9c2b5ba92ed897ce5896a00c47.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://sprites/glass_shards_packed.png"
dest_files=["res://.godot/imported/glass_shards_packed.png-31578c9c2b5ba92ed897ce5896a00c47.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

BIN
sprites/sink_and_mirror.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 622 B

View file

@ -0,0 +1,40 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bs5540jcnaf7o"
path="res://.godot/imported/sink_and_mirror.png-f27de7d3cfa17d4c14d2dcbf3cd91832.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://sprites/sink_and_mirror.png"
dest_files=["res://.godot/imported/sink_and_mirror.png-f27de7d3cfa17d4c14d2dcbf3cd91832.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

BIN
sprites/table.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

40
sprites/table.png.import Normal file
View file

@ -0,0 +1,40 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://cklakjbjislch"
path="res://.godot/imported/table.png-323cb18db94fde5a97f77a2a1125a74a.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://sprites/table.png"
dest_files=["res://.godot/imported/table.png-323cb18db94fde5a97f77a2a1125a74a.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1