frantic update to progression

This commit is contained in:
Skip 2022-07-18 13:00:02 -04:00
parent d0549e6d31
commit 5f5cacf8ae
9 changed files with 76 additions and 47 deletions

View File

@ -128,9 +128,9 @@ func belly_up(_cause: String) -> void:
print("You died on account of " + _cause + ". :(") print("You died on account of " + _cause + ". :(")
# flip fish upside-down # flip fish upside-down
# modulate tank red # modulate tank red
if not casual: # if not casual:
get_parent().phase = get_parent().Phase.START # get_parent().phase = get_parent().Phase.START
get_tree().reload_current_scene() # get_tree().reload_current_scene()
func _on_HungerTimer_timeout() -> void: func _on_HungerTimer_timeout() -> void:

View File

@ -10,7 +10,6 @@ onready var fish = get_node("/root/Tank/Fish")
func _ready(): func _ready():
# $Piranha.set_process(false) # $Piranha.set_process(false)
$Wire/AnimatedSprite.frame = 0 $Wire/AnimatedSprite.frame = 0
_spawn_piranha() #delete me later
func _on_Hitbox_area_entered(area): func _on_Hitbox_area_entered(area):
@ -19,16 +18,10 @@ func _on_Hitbox_area_entered(area):
hp -= 1 hp -= 1
if hp == 4: if hp == 4:
$Wire/AnimatedSprite.frame = 0 $Wire/AnimatedSprite.frame = 0
elif hp == 3:
_spawn_piranha() _spawn_piranha()
# var piranha_scene = load("res://Hazards/Piranha/Piranha.tscn")
# var piranha = piranha_scene.instance()
# get_parent().add_child(piranha)
# piranha.position = Vector2(300, -300)
elif hp > 0 and hp < 3: elif hp > 0 and hp < 3:
$Wire/AnimatedSprite.frame = 1 $Wire/AnimatedSprite.frame = 1
elif hp < 1: elif hp < 1 and get_parent().phase == get_parent().Phase.HEATER:
$Wire/AnimatedSprite.frame = 2 $Wire/AnimatedSprite.frame = 2
get_parent().blackout() get_parent().blackout()

View File

@ -57,9 +57,7 @@ tracks/3/keys = {
[sub_resource type="RectangleShape2D" id=2] [sub_resource type="RectangleShape2D" id=2]
extents = Vector2( 22.25, 28.25 ) extents = Vector2( 22.25, 28.25 )
[node name="Fork" type="Sprite" groups=[ [node name="Fork" type="Sprite" groups=["Knife"]]
"Knife",
]]
position = Vector2( 550, 570 ) position = Vector2( 550, 570 )
rotation = 3.14159 rotation = 3.14159
scale = Vector2( 2, 2 ) scale = Vector2( 2, 2 )

View File

@ -6,7 +6,7 @@
[ext_resource path="res://Hazards/Piranha/Sword.png" type="Texture" id=4] [ext_resource path="res://Hazards/Piranha/Sword.png" type="Texture" id=4]
[sub_resource type="CapsuleShape2D" id=1] [sub_resource type="CapsuleShape2D" id=1]
height = 644.0 height = 302.0
[sub_resource type="SpriteFrames" id=2] [sub_resource type="SpriteFrames" id=2]
animations = [ { animations = [ {
@ -17,9 +17,9 @@ animations = [ {
} ] } ]
[sub_resource type="CircleShape2D" id=3] [sub_resource type="CircleShape2D" id=3]
radius = 515.097 radius = 361.001
[node name="Piranha" type="Node2D"] [node name="Piranha" type="Node2D" groups=["Piranha"]]
script = ExtResource( 3 ) script = ExtResource( 3 )
[node name="SwordPivot" type="Position2D" parent="."] [node name="SwordPivot" type="Position2D" parent="."]
@ -27,9 +27,8 @@ position = Vector2( 4, 1 )
rotation = 6.28319 rotation = 6.28319
[node name="Sword" type="Sprite" parent="SwordPivot"] [node name="Sword" type="Sprite" parent="SwordPivot"]
position = Vector2( 470, -0.0022583 ) position = Vector2( 248, -0.00110769 )
rotation = 1.5708 rotation = 1.5708
scale = Vector2( 2, 2 )
texture = ExtResource( 4 ) texture = ExtResource( 4 )
[node name="SwordHitbox" type="Area2D" parent="SwordPivot"] [node name="SwordHitbox" type="Area2D" parent="SwordPivot"]
@ -40,7 +39,7 @@ position = Vector2( -212, 8.00004 )
polygon = PoolVector2Array( 458, -9, 467, -28, 524, -29, 523, -56, 546, -56, 547, -32, 781, -29, 906, -8, 782, 12, 549, 10, 550, 37, 526, 37, 524, 10, 466, 10 ) polygon = PoolVector2Array( 458, -9, 467, -28, 524, -29, 523, -56, 546, -56, 547, -32, 781, -29, 906, -8, 782, 12, 549, 10, 550, 37, 526, 37, 524, 10, 466, 10 )
[node name="CollisionShape2D" type="CollisionShape2D" parent="SwordPivot/SwordHitbox"] [node name="CollisionShape2D" type="CollisionShape2D" parent="SwordPivot/SwordHitbox"]
position = Vector2( 344, -6.00815e-05 ) position = Vector2( 178, -1.0008 )
rotation = 1.5708 rotation = 1.5708
shape = SubResource( 1 ) shape = SubResource( 1 )

View File

@ -1,15 +1,16 @@
extends RigidBody2D extends RigidBody2D
export var poisoned_color : Color = Color(0,0.78,0,1) export var poisoned_color : Color = Color(0,0.78,0,1)
var fish : Node onready var fish = get_node("/root/Tank/Fish")
var direction var direction
var projectile = false var projectile = false
func _ready(): func _ready():
fish = get_node("/root/Tank/Fish")
global_rotation_degrees = rand_range(0, 360) global_rotation_degrees = rand_range(0, 360)
$AnimatedSprite.frame = choose([0,1,2]) $AnimatedSprite.frame = choose([0,1,2])
if fish.poison_mutating:
$MutationTimer.start()
func _on_Hitbox_area_entered(area: Area2D) -> void: func _on_Hitbox_area_entered(area: Area2D) -> void:
@ -17,7 +18,21 @@ func _on_Hitbox_area_entered(area: Area2D) -> void:
$DissolveTimer.start() $DissolveTimer.start()
if not projectile and area.is_in_group("Fish") and not fish.invincible: if not projectile and area.is_in_group("Fish") and not fish.invincible:
if fish.poisoned == false and not fish.poison_mutation and modulate != Color(1,1,1,1): # Eat the pellet as poison if fish.poison_mutating:
fish.pellets += 1
#$TweenEat.interpolate_property(self, "position", position, get_node("/root/Tank/Fish/Positions/MouthInhale").get_global_position(), 0.5, Tween.TRANS_EXPO, Tween.EASE_IN, 0.5)
$TweenEat.interpolate_property(self, "position", position, get_node("/root/Tank/Fish/Positions/Mouth").get_global_position(), 0.5, Tween.TRANS_EXPO, Tween.EASE_IN)
$TweenEat.interpolate_property(self, "scale", scale, Vector2(0.1, 0.1), 0.5, Tween.TRANS_LINEAR, Tween.EASE_IN)
$TweenEat.start()
$Crunch.pitch_scale = rand_range(0.8, 1.2)
$Crunch.play()
yield($TweenEat, "tween_completed")
$PoisonTimer.start()
$TweenPoison.interpolate_property(area.get_parent(), "modulate", Color(1,1,1,1), poisoned_color, 2.0, Tween.TRANS_LINEAR, Tween.EASE_IN)
$TweenPoison.start()
fish.poison_mutation = true
queue_free()
elif fish.poisoned == false and not fish.poison_mutation and modulate != Color(1,1,1,1): # Eat the pellet as poison
print("A poison pellet has inflicted poison on the fish.") print("A poison pellet has inflicted poison on the fish.")
fish.poisoned = true fish.poisoned = true
visible = false visible = false
@ -51,3 +66,12 @@ func _on_DissolveTimer_timeout() -> void:
$TweenDissolve.start() $TweenDissolve.start()
yield($TweenDissolve, "tween_completed") yield($TweenDissolve, "tween_completed")
queue_free() queue_free()
func _on_MutationTimer_timeout() -> void:
fish.poison_mutating = true
var destination : Vector2
destination.x = fish.house_left_entrance.get_global_position().x
destination.y = fish.house_left_entrance.get_global_position().y + 100
$TweenMutation.interpolate_property(fish, "position", fish.global_position, destination, 0.7, Tween.TRANS_CIRC, Tween.EASE_IN)

View File

@ -20,9 +20,7 @@ extents = Vector2( 17.5, 19 )
[sub_resource type="RectangleShape2D" id=3] [sub_resource type="RectangleShape2D" id=3]
extents = Vector2( 28, 25 ) extents = Vector2( 28, 25 )
[node name="Poison" type="RigidBody2D" groups=[ [node name="Poison" type="RigidBody2D" groups=["Pellets"]]
"Pellets",
]]
modulate = Color( 0, 0.862745, 0, 1 ) modulate = Color( 0, 0.862745, 0, 1 )
collision_layer = 16 collision_layer = 16
collision_mask = 6 collision_mask = 6
@ -59,7 +57,12 @@ one_shot = true
[node name="Crunch" type="AudioStreamPlayer" parent="."] [node name="Crunch" type="AudioStreamPlayer" parent="."]
stream = ExtResource( 5 ) stream = ExtResource( 5 )
[node name="MutationTimer" type="Timer" parent="."]
[node name="TweenMutation" type="Tween" parent="."]
[connection signal="body_entered" from="." to="." method="_on_Poison_body_entered"] [connection signal="body_entered" from="." to="." method="_on_Poison_body_entered"]
[connection signal="area_entered" from="Hitbox" to="." method="_on_Hitbox_area_entered"] [connection signal="area_entered" from="Hitbox" to="." method="_on_Hitbox_area_entered"]
[connection signal="timeout" from="PoisonTimer" to="." method="_on_Timer_timeout"] [connection signal="timeout" from="PoisonTimer" to="." method="_on_Timer_timeout"]
[connection signal="timeout" from="DissolveTimer" to="." method="_on_DissolveTimer_timeout"] [connection signal="timeout" from="DissolveTimer" to="." method="_on_DissolveTimer_timeout"]
[connection signal="timeout" from="MutationTimer" to="." method="_on_MutationTimer_timeout"]

View File

@ -21,6 +21,7 @@ func _on_Hitbox_area_entered(area: Area2D) -> void:
func _die() -> void: func _die() -> void:
$DeadEye.visible = true $DeadEye.visible = true
fish.blackout() fish.blackout()
queue_free()
func _on_Timer_timeout(): func _on_Timer_timeout():

View File

@ -3,7 +3,7 @@ extends Node2D
#enum { PLAYING, GOING_IN, INSIDE, COMING_OUT} #enum { PLAYING, GOING_IN, INSIDE, COMING_OUT}
#var status = PLAYING #var status = PLAYING
enum Phase { START, CLEAN, KNIFE, HEATER, POISON, SQUID, ANGLER, NEXT } enum Phase { START, CLEAN, KNIFE, HEATER, POISON, POISON_MUTATE, SQUID, ANGLER, NEXT }
var phase = Phase.START var phase = Phase.START
@ -56,19 +56,21 @@ func blackout() -> void:
var squid_scene = load("res://Hazards/Squid/Squid.tscn") var squid_scene = load("res://Hazards/Squid/Squid.tscn")
var squid = squid_scene.instance() var squid = squid_scene.instance()
add_child(squid) add_child(squid)
$Fish.poison_mutation = true
print("Squid phase starting.")
if phase == Phase.POISON_MUTATE:
$Fish.poison_mutating = true
var poison_scene = load("res://Hazards/Poison/Poison.tscn") var poison_scene = load("res://Hazards/Poison/Poison.tscn")
var poison = poison_scene.instance() var poison = poison_scene.instance()
add_child(poison) add_child(poison)
poison.position = $House/RightEntrance.get_global_position() poison.position = $House/LeftEntrance.get_global_position()
$Fish.poison_mutating = true print("Poison mutation starting.")
$Fish.poison_mutation = true
if phase == Phase.POISON: if phase == Phase.POISON:
for piranha in get_tree().get_nodes_in_group("Piranha"):
piranha.queue_free()
$SurviveTimer.start() $SurviveTimer.start()
print("Poison phase starting.")
if phase == Phase.HEATER: if phase == Phase.HEATER:
for knife in get_tree().get_nodes_in_group("Knife"):
knife.queue_free()
for fork in get_tree().get_nodes_in_group("Fork"):
fork.queue_free()
var heater_scene = load("res://Hazards/Heater/Heater.tscn") var heater_scene = load("res://Hazards/Heater/Heater.tscn")
var heater = heater_scene.instance() var heater = heater_scene.instance()
add_child(heater) add_child(heater)
@ -96,13 +98,16 @@ func blackout() -> void:
func next_phase() -> void: func next_phase() -> void:
if phase == Phase.CLEAN: # Clean tank of pellets before poison phase if phase == Phase.CLEAN: # Clean tank of pellets before poison phase
var pellets = get_tree().get_nodes_in_group("Pellets") for pellet in get_tree().get_nodes_in_group("Pellets"):
for pellet in pellets:
pellet.queue_free() pellet.queue_free()
if phase == Phase.KNIFE: # Clean tank of poison before fork phase if phase == Phase.KNIFE: # Clean tank of poison before fork phase
var pellets = get_tree().get_nodes_in_group("Pellets") for pellet in get_tree().get_nodes_in_group("Pellets"):
for pellet in pellets:
pellet.queue_free() pellet.queue_free()
if phase == Phase.HEATER: #
for knife in get_tree().get_nodes_in_group("Knife"):
knife.queue_free()
for fork in get_tree().get_nodes_in_group("Fork"):
fork.queue_free()
phase += 1 phase += 1
@ -114,24 +119,30 @@ func _think() -> void:
thought.bbcode_text = \ thought.bbcode_text = \
"\n[center][tornado]ooOOoo! " + \ "\n[center][tornado]ooOOoo! " + \
"Does it really rain yummy treats in here? :D" "Does it really rain yummy treats in here? :D"
elif phase == Phase.POISON:
$Fish/ThoughtBubble.visible = true
thought.bbcode_text = \
"\n[center]Wait, something's wrong with these flakes!\n" + \
"[shake]Must... resist... eating...!"
elif phase == Phase.KNIFE: elif phase == Phase.KNIFE:
$Fish/ThoughtBubble.visible = true $Fish/ThoughtBubble.visible = true
thought.bbcode_text = \ thought.bbcode_text = \
"[center]WTF?! That was close!! Let's turn this tragedy into " + \ "[center]WTF?! That was close!! Let's turn this tragedy into " + \
"a travesty!\n([rainbow]DASH[/rainbow] unlocked!)" "a travesty!\n([rainbow]DASH[/rainbow] unlocked!)"
elif phase == Phase.POISON:
$Fish/ThoughtBubble.visible = true
thought.bbcode_text = \
"\n[center]Wait, something's wrong with these flakes!\n" + \
"[shake]Must... resist... eating...!"
elif phase == Phase.POISON_MUTATE:
$Fish/ThoughtBubble.visible = true
thought.bbcode_text = \
"[center]Actually... if I, erm, 'process' these fast enough...\n" + \
"Tragedy begets travesty once again!\n" + \
"([rainbow]TAIL CANNON[/rainbow] unlocked!)"
elif phase == Phase.SQUID: elif phase == Phase.SQUID:
$Fish/ThoughtBubble.visible = true $Fish/ThoughtBubble.visible = true
thought.bbcode_text = \ thought.bbcode_text = \
"[center]HOLY...! Wait a minute; I've got an idea!\n" + \ "[center]HOLY F--! Well I hope it likes poison!"
"([rainbow]TAIL CANNON[/rainbow] unlocked!)"
# Tween the $Thought.bbcode_text's percent_visible property # Tween the $Thought.bbcode_text's percent_visible property
func _on_SurviveTimer_timeout() -> void: func _on_SurviveTimer_timeout() -> void:
print("Time's up! Moving to next phase.")
blackout() blackout()

View File

@ -68,7 +68,7 @@ position = Vector2( 960, 1080 )
shape = SubResource( 2 ) shape = SubResource( 2 )
[node name="HazardSpawner" type="CollisionShape2D" parent="."] [node name="HazardSpawner" type="CollisionShape2D" parent="."]
position = Vector2( 960, -200 ) position = Vector2( 960, -90 )
shape = SubResource( 3 ) shape = SubResource( 3 )
[node name="HazardTimer" type="Timer" parent="HazardSpawner"] [node name="HazardTimer" type="Timer" parent="HazardSpawner"]
@ -144,7 +144,7 @@ position = Vector2( 160, 245 )
[node name="TweenBlackout" type="Tween" parent="."] [node name="TweenBlackout" type="Tween" parent="."]
[node name="SurviveTimer" type="Timer" parent="."] [node name="SurviveTimer" type="Timer" parent="."]
wait_time = 5.0 wait_time = 10.0
one_shot = true one_shot = true
[node name="FishFork" type="Sprite" parent="."] [node name="FishFork" type="Sprite" parent="."]