diff --git a/Travesty/Fish/Fish.gd b/Travesty/Fish/Fish.gd index f1abc98..f210b3d 100644 --- a/Travesty/Fish/Fish.gd +++ b/Travesty/Fish/Fish.gd @@ -128,9 +128,9 @@ func belly_up(_cause: String) -> void: print("You died on account of " + _cause + ". :(") # flip fish upside-down # modulate tank red - if not casual: - get_parent().phase = get_parent().Phase.START - get_tree().reload_current_scene() +# if not casual: +# get_parent().phase = get_parent().Phase.START +# get_tree().reload_current_scene() func _on_HungerTimer_timeout() -> void: diff --git a/Travesty/Hazards/Heater/Heater.gd b/Travesty/Hazards/Heater/Heater.gd index 82cdc93..12f4b83 100644 --- a/Travesty/Hazards/Heater/Heater.gd +++ b/Travesty/Hazards/Heater/Heater.gd @@ -10,7 +10,6 @@ onready var fish = get_node("/root/Tank/Fish") func _ready(): # $Piranha.set_process(false) $Wire/AnimatedSprite.frame = 0 - _spawn_piranha() #delete me later func _on_Hitbox_area_entered(area): @@ -19,16 +18,10 @@ func _on_Hitbox_area_entered(area): hp -= 1 if hp == 4: $Wire/AnimatedSprite.frame = 0 - elif hp == 3: _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: $Wire/AnimatedSprite.frame = 1 - elif hp < 1: + elif hp < 1 and get_parent().phase == get_parent().Phase.HEATER: $Wire/AnimatedSprite.frame = 2 get_parent().blackout() diff --git a/Travesty/Hazards/Knife/Knife.tscn b/Travesty/Hazards/Knife/Knife.tscn index d41837b..78dfd74 100644 --- a/Travesty/Hazards/Knife/Knife.tscn +++ b/Travesty/Hazards/Knife/Knife.tscn @@ -57,9 +57,7 @@ tracks/3/keys = { [sub_resource type="RectangleShape2D" id=2] extents = Vector2( 22.25, 28.25 ) -[node name="Fork" type="Sprite" groups=[ -"Knife", -]] +[node name="Fork" type="Sprite" groups=["Knife"]] position = Vector2( 550, 570 ) rotation = 3.14159 scale = Vector2( 2, 2 ) diff --git a/Travesty/Hazards/Piranha/Piranha.tscn b/Travesty/Hazards/Piranha/Piranha.tscn index e72d721..5056250 100644 --- a/Travesty/Hazards/Piranha/Piranha.tscn +++ b/Travesty/Hazards/Piranha/Piranha.tscn @@ -6,7 +6,7 @@ [ext_resource path="res://Hazards/Piranha/Sword.png" type="Texture" id=4] [sub_resource type="CapsuleShape2D" id=1] -height = 644.0 +height = 302.0 [sub_resource type="SpriteFrames" id=2] animations = [ { @@ -17,9 +17,9 @@ animations = [ { } ] [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 ) [node name="SwordPivot" type="Position2D" parent="."] @@ -27,9 +27,8 @@ position = Vector2( 4, 1 ) rotation = 6.28319 [node name="Sword" type="Sprite" parent="SwordPivot"] -position = Vector2( 470, -0.0022583 ) +position = Vector2( 248, -0.00110769 ) rotation = 1.5708 -scale = Vector2( 2, 2 ) texture = ExtResource( 4 ) [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 ) [node name="CollisionShape2D" type="CollisionShape2D" parent="SwordPivot/SwordHitbox"] -position = Vector2( 344, -6.00815e-05 ) +position = Vector2( 178, -1.0008 ) rotation = 1.5708 shape = SubResource( 1 ) diff --git a/Travesty/Hazards/Poison/Poison.gd b/Travesty/Hazards/Poison/Poison.gd index c086cce..4787b1f 100644 --- a/Travesty/Hazards/Poison/Poison.gd +++ b/Travesty/Hazards/Poison/Poison.gd @@ -1,15 +1,16 @@ extends RigidBody2D 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 projectile = false func _ready(): - fish = get_node("/root/Tank/Fish") global_rotation_degrees = rand_range(0, 360) $AnimatedSprite.frame = choose([0,1,2]) + if fish.poison_mutating: + $MutationTimer.start() func _on_Hitbox_area_entered(area: Area2D) -> void: @@ -17,7 +18,21 @@ func _on_Hitbox_area_entered(area: Area2D) -> void: $DissolveTimer.start() 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.") fish.poisoned = true visible = false @@ -51,3 +66,12 @@ func _on_DissolveTimer_timeout() -> void: $TweenDissolve.start() yield($TweenDissolve, "tween_completed") 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) + diff --git a/Travesty/Hazards/Poison/Poison.tscn b/Travesty/Hazards/Poison/Poison.tscn index 34ed3b0..7b85622 100644 --- a/Travesty/Hazards/Poison/Poison.tscn +++ b/Travesty/Hazards/Poison/Poison.tscn @@ -20,9 +20,7 @@ extents = Vector2( 17.5, 19 ) [sub_resource type="RectangleShape2D" id=3] extents = Vector2( 28, 25 ) -[node name="Poison" type="RigidBody2D" groups=[ -"Pellets", -]] +[node name="Poison" type="RigidBody2D" groups=["Pellets"]] modulate = Color( 0, 0.862745, 0, 1 ) collision_layer = 16 collision_mask = 6 @@ -59,7 +57,12 @@ one_shot = true [node name="Crunch" type="AudioStreamPlayer" parent="."] 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="area_entered" from="Hitbox" to="." method="_on_Hitbox_area_entered"] [connection signal="timeout" from="PoisonTimer" to="." method="_on_Timer_timeout"] [connection signal="timeout" from="DissolveTimer" to="." method="_on_DissolveTimer_timeout"] +[connection signal="timeout" from="MutationTimer" to="." method="_on_MutationTimer_timeout"] diff --git a/Travesty/Hazards/Squid/Squid.gd b/Travesty/Hazards/Squid/Squid.gd index 673cd9b..d351017 100644 --- a/Travesty/Hazards/Squid/Squid.gd +++ b/Travesty/Hazards/Squid/Squid.gd @@ -21,6 +21,7 @@ func _on_Hitbox_area_entered(area: Area2D) -> void: func _die() -> void: $DeadEye.visible = true fish.blackout() + queue_free() func _on_Timer_timeout(): diff --git a/Travesty/Tank/Tank.gd b/Travesty/Tank/Tank.gd index d3c4ac4..80d2612 100644 --- a/Travesty/Tank/Tank.gd +++ b/Travesty/Tank/Tank.gd @@ -3,7 +3,7 @@ extends Node2D #enum { PLAYING, GOING_IN, INSIDE, COMING_OUT} #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 @@ -56,19 +56,21 @@ func blackout() -> void: var squid_scene = load("res://Hazards/Squid/Squid.tscn") var squid = squid_scene.instance() 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 = poison_scene.instance() add_child(poison) - poison.position = $House/RightEntrance.get_global_position() - $Fish.poison_mutating = true - $Fish.poison_mutation = true + poison.position = $House/LeftEntrance.get_global_position() + print("Poison mutation starting.") if phase == Phase.POISON: + for piranha in get_tree().get_nodes_in_group("Piranha"): + piranha.queue_free() $SurviveTimer.start() + print("Poison phase starting.") 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 = heater_scene.instance() add_child(heater) @@ -96,13 +98,16 @@ func blackout() -> void: func next_phase() -> void: if phase == Phase.CLEAN: # Clean tank of pellets before poison phase - var pellets = get_tree().get_nodes_in_group("Pellets") - for pellet in pellets: + for pellet in get_tree().get_nodes_in_group("Pellets"): pellet.queue_free() if phase == Phase.KNIFE: # Clean tank of poison before fork phase - var pellets = get_tree().get_nodes_in_group("Pellets") - for pellet in pellets: + for pellet in get_tree().get_nodes_in_group("Pellets"): 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 @@ -114,24 +119,30 @@ func _think() -> void: thought.bbcode_text = \ "\n[center][tornado]ooOOoo! " + \ "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: $Fish/ThoughtBubble.visible = true thought.bbcode_text = \ "[center]WTF?! That was close!! Let's turn this tragedy into " + \ "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: $Fish/ThoughtBubble.visible = true thought.bbcode_text = \ - "[center]HOLY...! Wait a minute; I've got an idea!\n" + \ - "([rainbow]TAIL CANNON[/rainbow] unlocked!)" + "[center]HOLY F--! Well I hope it likes poison!" # Tween the $Thought.bbcode_text's percent_visible property func _on_SurviveTimer_timeout() -> void: + print("Time's up! Moving to next phase.") blackout() diff --git a/Travesty/Tank/Tank.tscn b/Travesty/Tank/Tank.tscn index dbeda1c..2215169 100644 --- a/Travesty/Tank/Tank.tscn +++ b/Travesty/Tank/Tank.tscn @@ -68,7 +68,7 @@ position = Vector2( 960, 1080 ) shape = SubResource( 2 ) [node name="HazardSpawner" type="CollisionShape2D" parent="."] -position = Vector2( 960, -200 ) +position = Vector2( 960, -90 ) shape = SubResource( 3 ) [node name="HazardTimer" type="Timer" parent="HazardSpawner"] @@ -144,7 +144,7 @@ position = Vector2( 160, 245 ) [node name="TweenBlackout" type="Tween" parent="."] [node name="SurviveTimer" type="Timer" parent="."] -wait_time = 5.0 +wait_time = 10.0 one_shot = true [node name="FishFork" type="Sprite" parent="."]