Reworked ending code to be more player node determined; added heart

animation; added reversable cloud scale toggle.
This commit is contained in:
Henry 2026-03-06 13:35:38 +00:00
parent 2db69a689b
commit 5bf3078953
10 changed files with 125 additions and 34 deletions

View file

@ -9,7 +9,7 @@ var tween_speed: float = 1.4
var pause: bool = false
var horse_counter: int = 0
var horse_counter: int = 1
var horse_phase: bool = true
var exploding:bool = false
var heart_taken: bool = false
@ -118,28 +118,31 @@ func heart_check():
print("Horse Counter:",horse_counter)
if heart_taken == true or heart_broken == true:
$Heart.monitoring = false
$Heart.monitorable = false
#$Heart.monitoring = false
#$Heart.monitorable = false
horse_phase = false
horse_phase_check()
func _on_ending(value: int):
func _on_ending(value: int):
if value == 1:
heart_taken = true
horse_phase = false
#horse_phase_check()
print("Fix your broken heart or die")
$Sprite2D.frame = 0
var tween = create_tween()
tween.tween_property(self, "position:y", 180, 2).set_ease(Tween.EASE_OUT)
tween.tween_property(self, "position:y", 60 * -1, .25).set_ease(Tween.EASE_IN)
await get_tree().create_timer(8).timeout
EventBus.goose_talk.emit(3)
self.monitoring = false
self.monitorable = false
#var tween = create_tween()
#tween.tween_property($Player, "position:y", 180, 2)#.set_ease(Tween.EASE_OUT)
#tween.tween_property($Player, "position:y", 60 * -1, .25)#.set_ease(Tween.EASE_IN)
#await get_tree().create_timer(8).timeout
#EventBus.goose_talk.emit(3)
#self.monitoring = false
#self.monitorable = false
if value == 2:

View file

@ -7,6 +7,7 @@
[ext_resource type="Texture2D" uid="uid://b0bdonvu25475" path="res://sprites/frame.png" id="4_qnbj4"]
[ext_resource type="Texture2D" uid="uid://dy743vehs0t1t" path="res://icon.svg" id="5_wqpjq"]
[ext_resource type="Texture2D" uid="uid://c4nhwvs13x5bc" path="res://sprites/heart.png" id="7_2cdgk"]
[ext_resource type="Script" uid="uid://b01h56iyb6pp2" path="res://scenes/heart.gd" id="7_qsl3t"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_neq0i"]
size = Vector2(129, 63)
@ -158,6 +159,44 @@ _data = {
[sub_resource type="RectangleShape2D" id="RectangleShape2D_qsl3t"]
size = Vector2(31, 28)
[sub_resource type="Animation" id="Animation_2avx2"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Sprite2D:scale")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Vector2(1, 1)]
}
[sub_resource type="Animation" id="Animation_5f346"]
resource_name = "beat"
length = 0.76666665
loop_mode = 1
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Sprite2D:scale")
tracks/0/interp = 0
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.25, 0.5),
"transitions": PackedFloat32Array(1, 1, 1),
"update": 0,
"values": [Vector2(1, 1), Vector2(1.15, 1.15), Vector2(0.75, 0.75)]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_0onds"]
_data = {
&"RESET": SubResource("Animation_2avx2"),
&"beat": SubResource("Animation_5f346")
}
[node name="Boss" type="Area2D" unique_id=2108172712 groups=["boss"]]
z_index = -1
script = ExtResource("1_neq0i")
@ -217,8 +256,8 @@ wait_time = 0.05
one_shot = true
[node name="Heart" type="Area2D" parent="." unique_id=1098254590 groups=["heart"]]
visible = false
position = Vector2(0, -71)
script = ExtResource("7_qsl3t")
[node name="Sprite2D" type="Sprite2D" parent="Heart" unique_id=520903474]
texture = ExtResource("7_2cdgk")
@ -227,4 +266,8 @@ texture = ExtResource("7_2cdgk")
position = Vector2(0.5, 0)
shape = SubResource("RectangleShape2D_qsl3t")
[node name="AnimationPlayer" type="AnimationPlayer" parent="Heart" unique_id=47669741]
libraries/ = SubResource("AnimationLibrary_0onds")
autoplay = &"beat"
[connection signal="timeout" from="Horse/ShootTimer" to="Horse" method="_on_shoot_timer_timeout"]

View file

@ -50,7 +50,7 @@ func _on_area_entered(area: Area2D) -> void:
"shards":
if area.is_in_group("shards"):
print("Shards hit!")
#print("Shards hit!")
area.hit_detection()
# stick_to_target(target)
reparent(area)
@ -59,7 +59,8 @@ func _on_area_entered(area: Area2D) -> void:
position = Vector2.ZERO
pause = true
$Sprite2D/GPUParticles2D.hide()
monitoring = false
self.monitoring = false
self.monitorable = false

View file

@ -13,11 +13,12 @@ signal goose_talk(frame_index: int)
# FX
signal flash_screen(duration: float)
signal cloud_speed()
signal cloud_speed(active: bool)
# Ending
signal ending(value: int)
signal win_game()
signal secret_win_game()
signal heart_beat(tempo: float)
@warning_ignore_restore("unused_signal") # put any future signals you add between the two ignore annotations

7
scenes/heart.gd Normal file
View file

@ -0,0 +1,7 @@
extends Area2D
func _ready() -> void:
EventBus.heart_beat.connect(_on_heart_beat)
func _on_heart_beat(tempo: float):
$AnimationPlayer.set_speed_scale(tempo)

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

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

View file

@ -116,6 +116,9 @@ func new_game():
add_child(instance)
$Player.start()
# Reset Clouds
EventBus.cloud_speed.emit(false)
# Do some DapperGoose talk
await get_tree().create_timer(1.5).timeout
EventBus.goose_talk.emit(6)
@ -158,8 +161,9 @@ func _on_secret_win_game():
func _on_win_game():
playing = false
game_over.show()
$Player._on_player_victory()
await $Player._on_player_victory()
game_over.show()
await get_tree().create_timer(8).timeout
game_over.hide()
$CanvasLayer/Title.show()

View file

@ -4,21 +4,37 @@ var scroll_multiplier: float = 400
@onready var parallax_nodes = get_tree().get_nodes_in_group("parallax_clouds")
func _ready():
EventBus.cloud_speed.connect(_on_cloud_speed)
func _on_cloud_speed():
func _on_cloud_speed(active: bool):
for node in parallax_nodes:
if active == true:
for node in parallax_nodes:
if node is Parallax2D:
var current_autoscroll = node.get_autoscroll()
current_autoscroll.y += scroll_multiplier
var tween = create_tween().set_trans(Tween.TRANS_LINEAR)
tween.tween_property(node, "autoscroll:y", scroll_multiplier, 5)
tween.tween_property(node, "modulate",Color(0.40,0.40,0.40), 2.5)
var coffee_dip = create_tween().set_trans(Tween.TRANS_QUAD)
coffee_dip.tween_property($CoffeeBuoy, "modulate", Color(0.40,0.40,0.40,0),2.5)
await coffee_dip.finished
$CoffeeBuoy.hide()
if active == false:
for node in parallax_nodes:
if node is Parallax2D:
var current_autoscroll = node.get_autoscroll()
current_autoscroll.y += scroll_multiplier
current_autoscroll.y -= scroll_multiplier
var tween = create_tween().set_trans(Tween.TRANS_LINEAR)
tween.tween_property(node, "autoscroll:y", scroll_multiplier, 5)
tween.tween_property(node, "modulate",Color(0.40,0.40,0.40), 2.5)
var coffee_dip = create_tween().set_trans(Tween.TRANS_QUAD)
coffee_dip.tween_property($CoffeeBuoy, "modulate", Color(0.40,0.40,0.40,0),2.5)
#coffee_dip.tween_property($CoffeeBuoy, "scale", .25, 2.5)
await coffee_dip.finished
$CoffeeBuoy.hide()
$CoffeeBuoy.show()
var coffee_dip = create_tween().set_trans(Tween.TRANS_QUAD)
coffee_dip.tween_property($CoffeeBuoy, "modulate", Color(1,1,1,1),2.5)
await coffee_dip.finished

View file

@ -14,6 +14,7 @@ var shield: int = 0:
var pause: bool = false
var can_shoot = false
var can_win = false
var shader_active: bool = false:
set(value):
if value == true:
@ -127,21 +128,35 @@ func _on_area_entered(area):
if area.is_in_group("horse"):
print("Entered horse!")
shield -= int(max_shield / 2)
_on_damage_taken()
#shield -= int(max_shield / 2)
#_on_damage_taken()
if area.is_in_group("boss"):
print("Entered boss!")
shield -= int(max_shield / 2)
_on_damage_taken()
if can_win == true:
print("You can win!")
area.reparent(self)
EventBus.win_game.emit()
elif can_win == false:
shield -= int(max_shield / 2)
_on_damage_taken()
if area.is_in_group("heart"):
print("Got the heart!")
pause = true
reparent(area)
#pause = true
area.reparent(self)
EventBus.heart_beat.emit(2.0)
ship.frame = 0
can_win = true
EventBus.ending.emit(1)
#if area.is_in_group("boss") and can_win == true:
print("You can win!")
self.monitoring = false
func _on_damage_taken():

View file

@ -25,7 +25,7 @@ func _ready():
func spawn_enemies():
if wave_count == 0: #This is for CHICKENS
if wave_count == 2: #This is for CHICKENS
print("Enemy Wave: ", wave_count)
enemy = CHICKEN
for x in range(COLS):
@ -53,7 +53,7 @@ func spawn_enemies():
enemy_count = rows_mod * cols_mod
await get_tree().process_frame
if wave_count == 2 : #This if for Mirror
if wave_count == 3 : #This if for Mirror
print("Enemy Wave: ", wave_count)
# Spawn Table
@ -89,12 +89,12 @@ func spawn_enemies():
s.start_all_animations()
if wave_count == 3 : #This is for Boss
if wave_count == 0 : #This is for Boss
# Hide the player
# Speed up parallax
EventBus.cloud_speed.emit()
EventBus.cloud_speed.emit(true)
# Spawn Boss
EventBus.flash_screen.emit(.25)