Reworked ending code to be more player node determined; added heart
animation; added reversable cloud scale toggle.
This commit is contained in:
parent
2db69a689b
commit
5bf3078953
10 changed files with 125 additions and 34 deletions
|
|
@ -9,7 +9,7 @@ var tween_speed: float = 1.4
|
||||||
var pause: bool = false
|
var pause: bool = false
|
||||||
|
|
||||||
|
|
||||||
var horse_counter: int = 0
|
var horse_counter: int = 1
|
||||||
var horse_phase: bool = true
|
var horse_phase: bool = true
|
||||||
var exploding:bool = false
|
var exploding:bool = false
|
||||||
var heart_taken: bool = false
|
var heart_taken: bool = false
|
||||||
|
|
@ -118,8 +118,8 @@ func heart_check():
|
||||||
print("Horse Counter:",horse_counter)
|
print("Horse Counter:",horse_counter)
|
||||||
|
|
||||||
if heart_taken == true or heart_broken == true:
|
if heart_taken == true or heart_broken == true:
|
||||||
$Heart.monitoring = false
|
#$Heart.monitoring = false
|
||||||
$Heart.monitorable = false
|
#$Heart.monitorable = false
|
||||||
horse_phase = false
|
horse_phase = false
|
||||||
|
|
||||||
horse_phase_check()
|
horse_phase_check()
|
||||||
|
|
@ -133,13 +133,16 @@ func _on_ending(value: int):
|
||||||
#horse_phase_check()
|
#horse_phase_check()
|
||||||
print("Fix your broken heart or die")
|
print("Fix your broken heart or die")
|
||||||
$Sprite2D.frame = 0
|
$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
|
#var tween = create_tween()
|
||||||
EventBus.goose_talk.emit(3)
|
#tween.tween_property($Player, "position:y", 180, 2)#.set_ease(Tween.EASE_OUT)
|
||||||
self.monitoring = false
|
#tween.tween_property($Player, "position:y", 60 * -1, .25)#.set_ease(Tween.EASE_IN)
|
||||||
self.monitorable = false
|
#await get_tree().create_timer(8).timeout
|
||||||
|
#EventBus.goose_talk.emit(3)
|
||||||
|
#self.monitoring = false
|
||||||
|
#self.monitorable = false
|
||||||
|
|
||||||
|
|
||||||
if value == 2:
|
if value == 2:
|
||||||
|
|
|
||||||
|
|
@ -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://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://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="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"]
|
[sub_resource type="RectangleShape2D" id="RectangleShape2D_neq0i"]
|
||||||
size = Vector2(129, 63)
|
size = Vector2(129, 63)
|
||||||
|
|
@ -158,6 +159,44 @@ _data = {
|
||||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_qsl3t"]
|
[sub_resource type="RectangleShape2D" id="RectangleShape2D_qsl3t"]
|
||||||
size = Vector2(31, 28)
|
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"]]
|
[node name="Boss" type="Area2D" unique_id=2108172712 groups=["boss"]]
|
||||||
z_index = -1
|
z_index = -1
|
||||||
script = ExtResource("1_neq0i")
|
script = ExtResource("1_neq0i")
|
||||||
|
|
@ -217,8 +256,8 @@ wait_time = 0.05
|
||||||
one_shot = true
|
one_shot = true
|
||||||
|
|
||||||
[node name="Heart" type="Area2D" parent="." unique_id=1098254590 groups=["heart"]]
|
[node name="Heart" type="Area2D" parent="." unique_id=1098254590 groups=["heart"]]
|
||||||
visible = false
|
|
||||||
position = Vector2(0, -71)
|
position = Vector2(0, -71)
|
||||||
|
script = ExtResource("7_qsl3t")
|
||||||
|
|
||||||
[node name="Sprite2D" type="Sprite2D" parent="Heart" unique_id=520903474]
|
[node name="Sprite2D" type="Sprite2D" parent="Heart" unique_id=520903474]
|
||||||
texture = ExtResource("7_2cdgk")
|
texture = ExtResource("7_2cdgk")
|
||||||
|
|
@ -227,4 +266,8 @@ texture = ExtResource("7_2cdgk")
|
||||||
position = Vector2(0.5, 0)
|
position = Vector2(0.5, 0)
|
||||||
shape = SubResource("RectangleShape2D_qsl3t")
|
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"]
|
[connection signal="timeout" from="Horse/ShootTimer" to="Horse" method="_on_shoot_timer_timeout"]
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ func _on_area_entered(area: Area2D) -> void:
|
||||||
|
|
||||||
"shards":
|
"shards":
|
||||||
if area.is_in_group("shards"):
|
if area.is_in_group("shards"):
|
||||||
print("Shards hit!")
|
#print("Shards hit!")
|
||||||
area.hit_detection()
|
area.hit_detection()
|
||||||
# stick_to_target(target)
|
# stick_to_target(target)
|
||||||
reparent(area)
|
reparent(area)
|
||||||
|
|
@ -59,7 +59,8 @@ func _on_area_entered(area: Area2D) -> void:
|
||||||
position = Vector2.ZERO
|
position = Vector2.ZERO
|
||||||
pause = true
|
pause = true
|
||||||
$Sprite2D/GPUParticles2D.hide()
|
$Sprite2D/GPUParticles2D.hide()
|
||||||
monitoring = false
|
self.monitoring = false
|
||||||
|
self.monitorable = false
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,11 +13,12 @@ signal goose_talk(frame_index: int)
|
||||||
|
|
||||||
# FX
|
# FX
|
||||||
signal flash_screen(duration: float)
|
signal flash_screen(duration: float)
|
||||||
signal cloud_speed()
|
signal cloud_speed(active: bool)
|
||||||
|
|
||||||
# Ending
|
# Ending
|
||||||
signal ending(value: int)
|
signal ending(value: int)
|
||||||
signal win_game()
|
signal win_game()
|
||||||
signal secret_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
|
@warning_ignore_restore("unused_signal") # put any future signals you add between the two ignore annotations
|
||||||
|
|
|
||||||
7
scenes/heart.gd
Normal file
7
scenes/heart.gd
Normal 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
1
scenes/heart.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
uid://b01h56iyb6pp2
|
||||||
|
|
@ -116,6 +116,9 @@ func new_game():
|
||||||
add_child(instance)
|
add_child(instance)
|
||||||
$Player.start()
|
$Player.start()
|
||||||
|
|
||||||
|
# Reset Clouds
|
||||||
|
EventBus.cloud_speed.emit(false)
|
||||||
|
|
||||||
# Do some DapperGoose talk
|
# Do some DapperGoose talk
|
||||||
await get_tree().create_timer(1.5).timeout
|
await get_tree().create_timer(1.5).timeout
|
||||||
EventBus.goose_talk.emit(6)
|
EventBus.goose_talk.emit(6)
|
||||||
|
|
@ -158,8 +161,9 @@ func _on_secret_win_game():
|
||||||
|
|
||||||
func _on_win_game():
|
func _on_win_game():
|
||||||
playing = false
|
playing = false
|
||||||
game_over.show()
|
|
||||||
$Player._on_player_victory()
|
$Player._on_player_victory()
|
||||||
|
await $Player._on_player_victory()
|
||||||
|
game_over.show()
|
||||||
await get_tree().create_timer(8).timeout
|
await get_tree().create_timer(8).timeout
|
||||||
game_over.hide()
|
game_over.hide()
|
||||||
$CanvasLayer/Title.show()
|
$CanvasLayer/Title.show()
|
||||||
|
|
|
||||||
|
|
@ -4,21 +4,37 @@ var scroll_multiplier: float = 400
|
||||||
|
|
||||||
@onready var parallax_nodes = get_tree().get_nodes_in_group("parallax_clouds")
|
@onready var parallax_nodes = get_tree().get_nodes_in_group("parallax_clouds")
|
||||||
|
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
EventBus.cloud_speed.connect(_on_cloud_speed)
|
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:
|
if node is Parallax2D:
|
||||||
var current_autoscroll = node.get_autoscroll()
|
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)
|
var tween = create_tween().set_trans(Tween.TRANS_LINEAR)
|
||||||
tween.tween_property(node, "autoscroll:y", scroll_multiplier, 5)
|
tween.tween_property(node, "autoscroll:y", scroll_multiplier, 5)
|
||||||
tween.tween_property(node, "modulate",Color(0.40,0.40,0.40), 2.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)
|
$CoffeeBuoy.show()
|
||||||
coffee_dip.tween_property($CoffeeBuoy, "modulate", Color(0.40,0.40,0.40,0),2.5)
|
var coffee_dip = create_tween().set_trans(Tween.TRANS_QUAD)
|
||||||
#coffee_dip.tween_property($CoffeeBuoy, "scale", .25, 2.5)
|
coffee_dip.tween_property($CoffeeBuoy, "modulate", Color(1,1,1,1),2.5)
|
||||||
await coffee_dip.finished
|
await coffee_dip.finished
|
||||||
$CoffeeBuoy.hide()
|
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ var shield: int = 0:
|
||||||
|
|
||||||
var pause: bool = false
|
var pause: bool = false
|
||||||
var can_shoot = false
|
var can_shoot = false
|
||||||
|
var can_win = false
|
||||||
var shader_active: bool = false:
|
var shader_active: bool = false:
|
||||||
set(value):
|
set(value):
|
||||||
if value == true:
|
if value == true:
|
||||||
|
|
@ -127,21 +128,35 @@ func _on_area_entered(area):
|
||||||
|
|
||||||
if area.is_in_group("horse"):
|
if area.is_in_group("horse"):
|
||||||
print("Entered horse!")
|
print("Entered horse!")
|
||||||
shield -= int(max_shield / 2)
|
#shield -= int(max_shield / 2)
|
||||||
_on_damage_taken()
|
#_on_damage_taken()
|
||||||
|
|
||||||
if area.is_in_group("boss"):
|
if area.is_in_group("boss"):
|
||||||
print("Entered 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"):
|
if area.is_in_group("heart"):
|
||||||
print("Got the heart!")
|
print("Got the heart!")
|
||||||
pause = true
|
#pause = true
|
||||||
reparent(area)
|
area.reparent(self)
|
||||||
|
EventBus.heart_beat.emit(2.0)
|
||||||
ship.frame = 0
|
ship.frame = 0
|
||||||
|
can_win = true
|
||||||
EventBus.ending.emit(1)
|
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():
|
func _on_damage_taken():
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ func _ready():
|
||||||
|
|
||||||
func spawn_enemies():
|
func spawn_enemies():
|
||||||
|
|
||||||
if wave_count == 0: #This is for CHICKENS
|
if wave_count == 2: #This is for CHICKENS
|
||||||
print("Enemy Wave: ", wave_count)
|
print("Enemy Wave: ", wave_count)
|
||||||
enemy = CHICKEN
|
enemy = CHICKEN
|
||||||
for x in range(COLS):
|
for x in range(COLS):
|
||||||
|
|
@ -53,7 +53,7 @@ func spawn_enemies():
|
||||||
enemy_count = rows_mod * cols_mod
|
enemy_count = rows_mod * cols_mod
|
||||||
await get_tree().process_frame
|
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)
|
print("Enemy Wave: ", wave_count)
|
||||||
|
|
||||||
# Spawn Table
|
# Spawn Table
|
||||||
|
|
@ -89,12 +89,12 @@ func spawn_enemies():
|
||||||
s.start_all_animations()
|
s.start_all_animations()
|
||||||
|
|
||||||
|
|
||||||
if wave_count == 3 : #This is for Boss
|
if wave_count == 0 : #This is for Boss
|
||||||
|
|
||||||
# Hide the player
|
# Hide the player
|
||||||
|
|
||||||
# Speed up parallax
|
# Speed up parallax
|
||||||
EventBus.cloud_speed.emit()
|
EventBus.cloud_speed.emit(true)
|
||||||
|
|
||||||
# Spawn Boss
|
# Spawn Boss
|
||||||
EventBus.flash_screen.emit(.25)
|
EventBus.flash_screen.emit(.25)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue