diff --git a/Travesty/Fish/Fish.gd b/Travesty/Fish/Fish.gd index 258b910..f1abc98 100644 --- a/Travesty/Fish/Fish.gd +++ b/Travesty/Fish/Fish.gd @@ -2,12 +2,16 @@ extends KinematicBody2D export var swim_length = 150 export var swim_cooldown = 1 +var casual = false # True prevents restarting from beginning after dying var destination # The position the fish will move to _on_SwimTimer_timeout() var pellets_consumed = 0 # Tracks the number of clean pellets eaten var invincible = false # Used during cutscenes such as returning home, etc var poisoned = false # Used in Hazards/Poison/Poison.gd to determine if fish is dying of poison -var poison_mutation = true # True when fish can eat and shoot poison pellets +var poison_mutating = false # Used in poison mutation cutscene +var poison_mutation = false # True when fish can eat and shoot poison pellets +var dash_mutation = false var pellets = 0 # Tracks the number of poison pellets eaten but not shot yet +var do_not_rotate = false # Used in Fork.tscn cutscene to stop fish from auto-rotating onready var mouth = $Positions/Mouth.position # Used for eating and shooting poison pellets onready var mouth_inhale = $Positions/MouthInhale.position # Used for eating poison pellets onready var tail = $Positions/Tail.position # Used for shooting poison pellets @@ -32,10 +36,14 @@ func _on_SwimTimer_timeout() -> void: destination = Vector2(move_toward(position.x, get_global_mouse_position().x, swim_length), new_y) $TweenSwim.interpolate_property(self, "position", position, destination, 1, Tween.TRANS_CUBIC, Tween.EASE_IN_OUT) $TweenSwim.start() + else: + if poison_mutating: + destination.x = house_right_entrance.get_global_position().x + destination.y = house_right_entrance.get_global_position().y + 100 func _process(delta: float) -> void: - if destination: + if destination and not do_not_rotate: var v if invincible: # Smoothly rotate fish to face destination v = destination - global_position @@ -71,6 +79,24 @@ func fire_pellet() -> void: pellets -= 1 +func dash() -> void: + $SwimTimer.stop() + if invincible and get_parent().phase == get_parent().Phase.KNIFE and get_node_or_null("/root/Tank/Fork"): + get_node("/root/Tank/FishFork").visible = false + destination = Vector2(position.x - (swim_length*3.5), position.y) + invincible = false + if get_node_or_null("/root/Tank/Fork"): + get_node("/root/Tank/Fork").retract() + get_parent().get_node("SurviveTimer").start() + do_not_rotate = false + else: + var new_y = clamp(move_toward(position.y, get_global_mouse_position().y, swim_length*3), 110, 1040) + destination = Vector2(move_toward(position.x, get_global_mouse_position().x, swim_length*3), new_y) + $TweenSwim.interpolate_property(self, "position", position, destination, 1, Tween.TRANS_CUBIC, Tween.EASE_IN_OUT) + $TweenSwim.start() + $SwimTimer.start() + + func go_inside() -> void: invincible = true destination = house_left_entrance.get_global_position() @@ -102,6 +128,8 @@ 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() diff --git a/Travesty/Fish/Fish.tscn b/Travesty/Fish/Fish.tscn index f9d1444..8cd144a 100644 --- a/Travesty/Fish/Fish.tscn +++ b/Travesty/Fish/Fish.tscn @@ -5,7 +5,7 @@ [ext_resource path="res://Fish/Fish2.png" type="Texture" id=3] [ext_resource path="res://Fish/Thasadith-BoldItalic.ttf" type="DynamicFontData" id=4] -[sub_resource type="SpriteFrames" id=3] +[sub_resource type="SpriteFrames" id=1] animations = [ { "frames": [ ExtResource( 1 ), ExtResource( 3 ) ], "loop": true, @@ -13,11 +13,11 @@ animations = [ { "speed": 2.0 } ] -[sub_resource type="CapsuleShape2D" id=1] +[sub_resource type="CapsuleShape2D" id=2] radius = 17.0 height = 88.0 -[sub_resource type="CapsuleShape2D" id=2] +[sub_resource type="CapsuleShape2D" id=3] radius = 21.0 height = 80.0 @@ -37,21 +37,24 @@ swim_length = 200 [node name="AnimatedSprite" type="AnimatedSprite" parent="."] position = Vector2( -12, -17 ) scale = Vector2( -0.5, 0.5 ) -frames = SubResource( 3 ) +frames = SubResource( 1 ) +frame = 1 playing = true [node name="CollisionShape2D" type="CollisionShape2D" parent="."] visible = false position = Vector2( -18, 3 ) rotation = 1.5708 -shape = SubResource( 1 ) +shape = SubResource( 2 ) -[node name="Hitbox" type="Area2D" parent="." groups=["Fish"]] +[node name="Hitbox" type="Area2D" parent="." groups=[ +"Fish", +]] [node name="CollisionShape2D" type="CollisionShape2D" parent="Hitbox"] position = Vector2( -8, 1 ) rotation = 1.5708 -shape = SubResource( 2 ) +shape = SubResource( 3 ) [node name="SwimTimer" type="Timer" parent="."] autostart = true @@ -86,9 +89,9 @@ margin_left = -137.0 margin_top = -200.0 margin_right = 138.0 margin_bottom = -80.0 +custom_fonts/normal_font = SubResource( 4 ) custom_colors/default_color = Color( 0.945098, 0.352941, 0.160784, 1 ) custom_constants/line_separation = -6 -custom_fonts/normal_font = SubResource( 4 ) bbcode_enabled = true bbcode_text = "[center]Wait, something's wrong with these flakes! [shake] Must... resist... eating...!" diff --git a/Travesty/Hazards/Fork/FishFork.png b/Travesty/Hazards/Fork/FishFork.png new file mode 100644 index 0000000..65e9ab2 Binary files /dev/null and b/Travesty/Hazards/Fork/FishFork.png differ diff --git a/Travesty/Hazards/Fork/FishFork.png.import b/Travesty/Hazards/Fork/FishFork.png.import new file mode 100644 index 0000000..776dbfd --- /dev/null +++ b/Travesty/Hazards/Fork/FishFork.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/FishFork.png-80c835c5b3cc00cf5104ddc30f41daa5.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Hazards/Fork/FishFork.png" +dest_files=[ "res://.import/FishFork.png-80c835c5b3cc00cf5104ddc30f41daa5.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=true +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/Travesty/Hazards/Fork/Fork.gd b/Travesty/Hazards/Fork/Fork.gd index 97499ec..b1c1898 100644 --- a/Travesty/Hazards/Fork/Fork.gd +++ b/Travesty/Hazards/Fork/Fork.gd @@ -4,33 +4,49 @@ extends Sprite onready var tank = get_node("/root/Tank") onready var spawner = get_node("/root/Tank/HazardSpawner") var playingforwards = true +onready var fish = get_node("/root/Tank/Fish") +onready var interception = get_node("/root/Tank/House/LeftEntrance").get_global_position() +onready var sticker = get_node("/root/Tank/FishFork") +var retracting = false -#func _ready() -> void: -# $Timer.start() -# -# -#func _on_Timer_timeout() -> void: -# _reposition() -# yield($Tween, "tween_completed") -# _stab() -# yield($AnimationPlayer, "animation_finished") -# _retract() +func _process(delta: float) -> void: + if retracting: + position.y -= 1 + if position.y < -100: + var knife_scene = load("res://Hazards/Knife/Knife.tscn") + var knife = knife_scene.instance() + get_parent().add_child(knife) + fish.invincible = false + queue_free() - -func _reposition() -> void: - var tween_duration = 1 - $Tween.interpolate_property(self, "position:x", position.x, rand_range(400, 2000), tween_duration, Tween.TRANS_BACK, Tween.EASE_IN_OUT) - $Tween.start() +func _on_Timer_timeout() -> void: + fish.do_not_rotate = true + $TweenPrep.interpolate_property(fish, "position", fish.position.x, interception.x, 1, Tween.TRANS_BACK, Tween.EASE_IN, 0.5) + $TweenPrep.interpolate_property(self, "position:x", position.x, interception.x+230, 0.5, Tween.TRANS_BACK, Tween.EASE_IN) + $TweenPrep.start() + yield($TweenPrep, "tween_completed") +# $TweenStab.interpolate_property(self, "position:y", get_global_position().y, interception.y+530, 0.2, Tween.TRANS_CIRC, Tween.EASE_IN) +# $TweenStab.start() + $AnimationPlayer.play("Stab") + yield($AnimationPlayer, "animation_finished") + sticker.visible = true + get_parent()._think() + fish.dash_mutation = true func _stab() -> void: $AnimationPlayer.play("Stab") +# yield($AnimationPlayer, "animation_finished") + sticker.visible = true + print("Sticker's z_index = " + str(sticker.z_index)) -func _retract() -> void: +func retract() -> void: $AnimationPlayer.play_backwards("Stab") - + yield($AnimationPlayer, "animation_finished") + retracting = true + func destroy() -> void: queue_free() diff --git a/Travesty/Hazards/Fork/Fork.tscn b/Travesty/Hazards/Fork/Fork.tscn index b7635ea..3dbbcdb 100644 --- a/Travesty/Hazards/Fork/Fork.tscn +++ b/Travesty/Hazards/Fork/Fork.tscn @@ -3,7 +3,7 @@ [ext_resource path="res://Hazards/Fork/Fork.gd" type="Script" id=1] [ext_resource path="res://Hazards/Fork/Fork.png" type="Texture" id=2] -[sub_resource type="Animation" id=2] +[sub_resource type="Animation" id=1] resource_name = "Stab" length = 0.1 tracks/0/type = "value" @@ -54,13 +54,16 @@ tracks/3/keys = { "values": [ Vector2( 0, 0 ), Vector2( 0, -400 ) ] } -[sub_resource type="RectangleShape2D" id=3] +[sub_resource type="RectangleShape2D" id=2] extents = Vector2( 22.25, 28.25 ) -[node name="Fork" type="Sprite"] +[node name="Fork" type="Sprite" groups=[ +"Fork", +]] position = Vector2( 550, 570 ) rotation = 3.14159 scale = Vector2( 2, 2 ) +z_index = -1 texture = ExtResource( 2 ) region_enabled = true region_rect = Rect2( 0, -400, 300, 470 ) @@ -68,22 +71,28 @@ script = ExtResource( 1 ) [node name="ForkAbove" type="Sprite" parent="."] position = Vector2( 220.499, 278.001 ) +z_index = 1 texture = ExtResource( 2 ) region_enabled = true region_rect = Rect2( 200, 10, 300, 100 ) -[node name="Timer" type="Timer" parent="."] -wait_time = 1.75 +[node name="Delay" type="Timer" parent="."] +wait_time = 1.5 +one_shot = true +autostart = true [node name="AnimationPlayer" type="AnimationPlayer" parent="."] -anims/Stab = SubResource( 2 ) +anims/Stab = SubResource( 1 ) [node name="Hitbox" type="Area2D" parent="."] +visible = false [node name="CollisionShape2D" type="CollisionShape2D" parent="Hitbox"] position = Vector2( 108.749, 205.75 ) -shape = SubResource( 3 ) +shape = SubResource( 2 ) -[node name="Tween" type="Tween" parent="."] +[node name="TweenPrep" type="Tween" parent="."] -[connection signal="timeout" from="Timer" to="." method="_on_Timer_timeout"] +[node name="TweenStab" type="Tween" parent="."] + +[connection signal="timeout" from="Delay" to="." method="_on_Timer_timeout"] diff --git a/Travesty/Hazards/Heater/Heater.gd b/Travesty/Hazards/Heater/Heater.gd index a94b1ea..81d5f3d 100644 --- a/Travesty/Hazards/Heater/Heater.gd +++ b/Travesty/Hazards/Heater/Heater.gd @@ -1,34 +1,48 @@ extends Node2D +var hp = 5 +var immune = false +var immune_timer = 0 + -enum { TOP, MID, BOT } -var active_channel = TOP onready var fish = get_node("/root/Tank/Fish") func _ready(): - pass +# $Piranha.set_process(false) + $Wire/AnimatedSprite.frame = 0 + _spawn_piranha() #delete me later -func _on_Timer_timeout() -> void: - active_channel += 1 - - if active_channel == TOP: - var areas = $TopChannel.get_overlapping_areas() - for area in areas: - if area.is_in_group("Fish"): - var destination = $TopChannel/CollisionShape2D.position - $TopChannel/CollisionShape2D.extents - $TweenPush.interpolate_property(fish, "position:x", position.x, destination.x, 1.5, Tween.TRANS_CIRC, Tween.EASE_IN_OUT) - print("Pushing fish back!") - fish.get_node("TweenSwim").stop_all() - if active_channel == MID: - var areas = $MidChannel.get_overlapping_areas() - for area in areas: - if area.is_in_group("Fish"): - print("Pushing fish back!") - fish.get_node("TweenSwim").stop_all() - if active_channel == BOT: - var areas = $TopChannel.get_overlapping_areas() - for area in areas: - if area.is_in_group("Fish"): - print("Pushing fish back!") - fish.get_node("TweenSwim").stop_all() +func _on_Hitbox_area_entered(area): + if area.is_in_group("Fish") and $InvulnTimer.time_left == 0: + $AnimationPlayer.play("recoil") + 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: + $Wire/AnimatedSprite.frame = 2 + get_parent().blackout() + + +func _spawn_piranha(): + #$AnimationPlayer.play("drop") + #yield($AnimationPlayer, "animation_finished") + var piranha_scene = load("res://Hazards/Piranha/Piranha.tscn") + var piranha = piranha_scene.instance() +# piranha.set_process(false) + get_parent().add_child(piranha) + piranha.position = Vector2(300, -300) + $TweenDrop.interpolate_property(piranha, "position:y", piranha.get_global_position().y, 600, 0.5, Tween.TRANS_BACK, Tween.EASE_IN) + $TweenDrop.start() + yield($TweenDrop, "tween_completed") + print("dropped") +# piranha.set_process(true) diff --git a/Travesty/Hazards/Heater/Heater.tscn b/Travesty/Hazards/Heater/Heater.tscn index c2ccbe5..68d2b9f 100644 --- a/Travesty/Hazards/Heater/Heater.tscn +++ b/Travesty/Hazards/Heater/Heater.tscn @@ -1,11 +1,11 @@ -[gd_scene load_steps=7 format=2] +[gd_scene load_steps=9 format=2] [ext_resource path="res://Hazards/Heater/Heater2.png" type="Texture" id=1] [ext_resource path="res://Hazards/Heater/Heater3.png" type="Texture" id=2] [ext_resource path="res://Hazards/Heater/Heater1.png" type="Texture" id=3] [ext_resource path="res://Hazards/Heater/Heater.gd" type="Script" id=4] -[sub_resource type="SpriteFrames" id=1] +[sub_resource type="SpriteFrames" id=2] animations = [ { "frames": [ ExtResource( 3 ), ExtResource( 1 ), ExtResource( 2 ) ], "loop": true, @@ -13,28 +13,68 @@ animations = [ { "speed": 5.0 } ] -[sub_resource type="CapsuleShape2D" id=2] +[sub_resource type="CapsuleShape2D" id=1] radius = 81.0 height = 714.0 +[sub_resource type="Animation" id=4] +resource_name = "drop" +length = 0.5 + +[sub_resource type="Animation" id=3] +resource_name = "recoil" +length = 2.1 +tracks/0/type = "value" +tracks/0/path = NodePath("Wire:rotation_degrees") +tracks/0/interp = 2 +tracks/0/loop_wrap = true +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/keys = { +"times": PoolRealArray( 0, 0.3, 0.6, 0.9, 1, 1.1 ), +"transitions": PoolRealArray( 1, 1, 1, 1, 1, 1 ), +"update": 0, +"values": [ 0.0, -11.0, 5.0, 0.0, -1.0, 0.0 ] +} +tracks/1/type = "value" +tracks/1/path = NodePath("Wire/AnimatedSprite:modulate") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/keys = { +"times": PoolRealArray( 0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2, 2.1 ), +"transitions": PoolRealArray( 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ), +"update": 0, +"values": [ Color( 1, 1, 1, 1 ), Color( 1, 0, 0, 1 ), Color( 0, 0, 0, 1 ), Color( 1, 1, 1, 1 ), Color( 1, 0, 0, 1 ), Color( 0, 0, 0, 1 ), Color( 1, 1, 1, 1 ), Color( 1, 0, 0, 1 ), Color( 0, 0, 0, 1 ), Color( 1, 1, 1, 1 ), Color( 1, 0, 0, 1 ), Color( 0, 0, 0, 1 ), Color( 1, 1, 1, 1 ), Color( 1, 0, 0, 1 ), Color( 0, 0, 0, 1 ), Color( 1, 1, 1, 1 ), Color( 1, 0, 0, 1 ), Color( 0, 0, 0, 1 ), Color( 1, 1, 1, 1 ), Color( 1, 0, 0, 1 ), Color( 0, 0, 0, 1 ), Color( 1, 0.999998, 0.999998, 1 ) ] +} + [node name="Heater" type="Node2D"] +position = Vector2( 1665, 497 ) script = ExtResource( 4 ) -[node name="PivotPoint" type="Position2D" parent="."] -position = Vector2( 3, -494 ) +[node name="Wire" type="Position2D" parent="."] +position = Vector2( 4, -482 ) -[node name="Sprite" type="AnimatedSprite" parent="PivotPoint"] -position = Vector2( 0, 494 ) -frames = SubResource( 1 ) +[node name="AnimatedSprite" type="AnimatedSprite" parent="Wire"] +position = Vector2( -1, 482 ) +frames = SubResource( 2 ) -[node name="Hitbox" type="Area2D" parent="."] +[node name="Hitbox" type="Area2D" parent="Wire"] +position = Vector2( -4, 482 ) -[node name="CollisionShape2D" type="CollisionShape2D" parent="Hitbox"] +[node name="CollisionShape2D" type="CollisionShape2D" parent="Wire/Hitbox"] position = Vector2( 0, 29 ) -shape = SubResource( 2 ) +shape = SubResource( 1 ) -[node name="Timer" type="Timer" parent="."] +[node name="InvulnTimer" type="Timer" parent="."] +wait_time = 2.1 +one_shot = true -[node name="TweenPush" type="Tween" parent="."] +[node name="AnimationPlayer" type="AnimationPlayer" parent="."] +anims/drop = SubResource( 4 ) +anims/recoil = SubResource( 3 ) -[connection signal="timeout" from="Timer" to="." method="_on_Timer_timeout"] +[node name="TweenDrop" type="Tween" parent="."] + +[connection signal="area_entered" from="Wire/Hitbox" to="." method="_on_Hitbox_area_entered"] diff --git a/Travesty/Hazards/Knife/Knife.tscn b/Travesty/Hazards/Knife/Knife.tscn index 5602f37..d41837b 100644 --- a/Travesty/Hazards/Knife/Knife.tscn +++ b/Travesty/Hazards/Knife/Knife.tscn @@ -1,9 +1,9 @@ [gd_scene load_steps=5 format=2] [ext_resource path="res://Hazards/Knife/Knife.gd" type="Script" id=1] -[ext_resource path="res://Hazards/Fork/Fork.png" type="Texture" id=2] +[ext_resource path="res://Hazards/Knife/Knife.png" type="Texture" id=2] -[sub_resource type="Animation" id=2] +[sub_resource type="Animation" id=1] resource_name = "Stab" length = 0.1 tracks/0/type = "value" @@ -54,10 +54,12 @@ tracks/3/keys = { "values": [ Vector2( 0, 0 ), Vector2( 0, -400 ) ] } -[sub_resource type="RectangleShape2D" id=3] +[sub_resource type="RectangleShape2D" id=2] extents = Vector2( 22.25, 28.25 ) -[node name="Fork" type="Sprite"] +[node name="Fork" type="Sprite" groups=[ +"Knife", +]] position = Vector2( 550, 570 ) rotation = 3.14159 scale = Vector2( 2, 2 ) @@ -76,13 +78,13 @@ region_rect = Rect2( 200, 10, 300, 100 ) wait_time = 1.75 [node name="AnimationPlayer" type="AnimationPlayer" parent="."] -anims/Stab = SubResource( 2 ) +anims/Stab = SubResource( 1 ) [node name="Hitbox" type="Area2D" parent="."] [node name="CollisionShape2D" type="CollisionShape2D" parent="Hitbox"] position = Vector2( 108.749, 205.75 ) -shape = SubResource( 3 ) +shape = SubResource( 2 ) [node name="Tween" type="Tween" parent="."] diff --git a/Travesty/Hazards/Piranha/Piranha.gd b/Travesty/Hazards/Piranha/Piranha.gd index 342dc60..5788a1c 100644 --- a/Travesty/Hazards/Piranha/Piranha.gd +++ b/Travesty/Hazards/Piranha/Piranha.gd @@ -1,8 +1,11 @@ extends Node2D - +export var hp : int = 3 # Number of hits before dying onready var fish = get_node("/root/Tank/Fish") - +var moving = true +var dest_counter : int = 0 +var next_dest = 60 +var destination : Vector2 func _ready(): pass @@ -10,9 +13,33 @@ func _ready(): func _process(delta: float) -> void: $SwordPivot.rotation_degrees += 1 + if dest_counter >= next_dest: + destination = _select_destination() + next_dest = rand_range(60,1200) # second number lower = move more frequently + dest_counter = 0 + else: + dest_counter +=1 + if moving: + $TweenSwim.interpolate_property(self, "position", get_global_position(), destination, .175, Tween.TRANS_CUBIC, Tween.EASE_IN_OUT) #number lower = faster + $TweenSwim.start() + + +func _select_destination() -> Vector2: + var dest = Vector2(rand_range(200, 1500), rand_range(200, 880)) + return dest func _on_SwordHitbox_area_entered(area: Area2D) -> void: - pass # Replace with function body. -# if is_in_group("Fish"): -# fish.belly_up() + if area.is_in_group("Fish"): + fish.belly_up("Piranha") + + +func _on_Blindzone_area_entered(area: Area2D) -> void: + if area.is_in_group("Fish"): + moving = false + $TweenSwim.stop_all() + + +func _on_Blindzone_area_exited(area): + if area.is_in_group("Fish"): + moving = true diff --git a/Travesty/Hazards/Piranha/Piranha.tscn b/Travesty/Hazards/Piranha/Piranha.tscn index b4b403e..71fbbc8 100644 --- a/Travesty/Hazards/Piranha/Piranha.tscn +++ b/Travesty/Hazards/Piranha/Piranha.tscn @@ -1,13 +1,14 @@ -[gd_scene load_steps=7 format=2] +[gd_scene load_steps=8 format=2] [ext_resource path="res://Hazards/Piranha/Piranha2.png" type="Texture" id=1] [ext_resource path="res://Hazards/Piranha/Piranha1.png" type="Texture" id=2] [ext_resource path="res://Hazards/Piranha/Piranha.gd" type="Script" id=3] +[ext_resource path="res://Hazards/Piranha/Sword.png" type="Texture" id=4] -[sub_resource type="CapsuleShape2D" id=2] +[sub_resource type="CapsuleShape2D" id=1] height = 644.0 -[sub_resource type="SpriteFrames" id=1] +[sub_resource type="SpriteFrames" id=2] animations = [ { "frames": [ ExtResource( 2 ), ExtResource( 1 ) ], "loop": true, @@ -26,22 +27,28 @@ position = Vector2( 4, 1 ) rotation = 6.28319 [node name="Sword" type="Sprite" parent="SwordPivot"] +position = Vector2( 470, -0.0022583 ) +rotation = 1.5708 +scale = Vector2( 2, 2 ) +texture = ExtResource( 4 ) [node name="SwordHitbox" type="Area2D" parent="SwordPivot"] [node name="StandinArt" type="Polygon2D" parent="SwordPivot/SwordHitbox"] +visible = false 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 ) rotation = 1.5708 -shape = SubResource( 2 ) +shape = SubResource( 1 ) [node name="AnimatedSprite" type="AnimatedSprite" parent="."] position = Vector2( 67, -25 ) scale = Vector2( 0.5, 0.5 ) -frames = SubResource( 1 ) +frames = SubResource( 2 ) +frame = 1 playing = true [node name="Blindzone" type="Area2D" parent="."] @@ -50,4 +57,8 @@ playing = true position = Vector2( 2, 5 ) shape = SubResource( 3 ) +[node name="TweenSwim" type="Tween" parent="."] + [connection signal="area_entered" from="SwordPivot/SwordHitbox" to="." method="_on_SwordHitbox_area_entered"] +[connection signal="area_entered" from="Blindzone" to="." method="_on_Blindzone_area_entered"] +[connection signal="area_exited" from="Blindzone" to="." method="_on_Blindzone_area_exited"] diff --git a/Travesty/Hazards/Piranha/Sword.png b/Travesty/Hazards/Piranha/Sword.png new file mode 100644 index 0000000..68575b5 Binary files /dev/null and b/Travesty/Hazards/Piranha/Sword.png differ diff --git a/Travesty/Hazards/Piranha/Sword.png.import b/Travesty/Hazards/Piranha/Sword.png.import new file mode 100644 index 0000000..49688ce --- /dev/null +++ b/Travesty/Hazards/Piranha/Sword.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/Sword.png-b12c437c46fa5a29f1c36d9c498af1fa.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Hazards/Piranha/Sword.png" +dest_files=[ "res://.import/Sword.png-b12c437c46fa5a29f1c36d9c498af1fa.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=true +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/Travesty/Hazards/Poison/Poison.gd b/Travesty/Hazards/Poison/Poison.gd index ebd191a..c086cce 100644 --- a/Travesty/Hazards/Poison/Poison.gd +++ b/Travesty/Hazards/Poison/Poison.gd @@ -17,7 +17,7 @@ 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: # Eat the pellet as poison + if 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 diff --git a/Travesty/Hazards/Poison/Poison.tscn b/Travesty/Hazards/Poison/Poison.tscn index bea4bcf..34ed3b0 100644 --- a/Travesty/Hazards/Poison/Poison.tscn +++ b/Travesty/Hazards/Poison/Poison.tscn @@ -20,7 +20,9 @@ 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 diff --git a/Travesty/Hazards/Squid/Dead_Eye.png b/Travesty/Hazards/Squid/Dead_Eye.png new file mode 100644 index 0000000..2be5d93 Binary files /dev/null and b/Travesty/Hazards/Squid/Dead_Eye.png differ diff --git a/Travesty/Hazards/Squid/Dead_Eye.png.import b/Travesty/Hazards/Squid/Dead_Eye.png.import new file mode 100644 index 0000000..983b838 --- /dev/null +++ b/Travesty/Hazards/Squid/Dead_Eye.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/Dead_Eye.png-bddaeca02403ec4f0de0bb55a2e64aba.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Hazards/Squid/Dead_Eye.png" +dest_files=[ "res://.import/Dead_Eye.png-bddaeca02403ec4f0de0bb55a2e64aba.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=true +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/Travesty/Hazards/Squid/Squid.gd b/Travesty/Hazards/Squid/Squid.gd index 25ed7b5..673cd9b 100644 --- a/Travesty/Hazards/Squid/Squid.gd +++ b/Travesty/Hazards/Squid/Squid.gd @@ -1,13 +1,26 @@ extends Node2D +export var hp = 10 +onready var fish = get_node("/root/Tank/Fish") + func _ready(): + $TweenSpawn.interpolate_property(self, "modulate", Color(1,0,0,1), Color(1,1,1,1), 3, Tween.TRANS_EXPO, Tween.EASE_IN) + $TweenSpawn.start() + yield($TweenSpawn, "tween_completed") $Timer.start() func _on_Hitbox_area_entered(area: Area2D) -> void: - if area.is_in_group("Fish"): - area.kill() + if area.is_in_group("Projectile"): + hp -= 1 + if hp < 1: + _die() + + +func _die() -> void: + $DeadEye.visible = true + fish.blackout() func _on_Timer_timeout(): @@ -26,3 +39,8 @@ func _reposition() -> void: $Tween.interpolate_property($Tentacle, "position:y", $Tentacle.position.y, rand_range(0, 900), tween_duration, Tween.TRANS_BACK, Tween.EASE_IN_OUT) $Tween.start() yield($Tween, "tween_completed") + + +func _on_Hurtbox_area_entered(area: Area2D) -> void: + if area.is_in_group("Fish"): + fish.belly_up("a tentacle") diff --git a/Travesty/Hazards/Squid/Squid.tscn b/Travesty/Hazards/Squid/Squid.tscn index a1fda46..6b79c19 100644 --- a/Travesty/Hazards/Squid/Squid.tscn +++ b/Travesty/Hazards/Squid/Squid.tscn @@ -1,12 +1,12 @@ -[gd_scene load_steps=5 format=2] +[gd_scene load_steps=6 format=2] [ext_resource path="res://Hazards/Squid/Squid2.png" type="Texture" id=1] [ext_resource path="res://Hazards/Squid/Tentacle.png" type="Texture" id=2] [ext_resource path="res://Hazards/Squid/Squid.gd" type="Script" id=3] +[ext_resource path="res://Hazards/Squid/Dead_Eye.png" type="Texture" id=4] -[sub_resource type="Animation" id=2] +[sub_resource type="Animation" id=1] resource_name = "Stab" -length = 0.3 tracks/0/type = "value" tracks/0/path = NodePath("Tentacle:position:x") tracks/0/interp = 1 @@ -14,7 +14,7 @@ tracks/0/loop_wrap = true tracks/0/imported = false tracks/0/enabled = true tracks/0/keys = { -"times": PoolRealArray( 0, 0.3 ), +"times": PoolRealArray( 0, 1 ), "transitions": PoolRealArray( 1, 1 ), "update": 0, "values": [ -900.0, 0.0 ] @@ -28,11 +28,11 @@ position = Vector2( -900, 0 ) texture = ExtResource( 2 ) centered = false -[node name="Hitbox" type="Area2D" parent="Tentacle"] +[node name="Hurtbox" type="Area2D" parent="Tentacle"] visible = false position = Vector2( 900, 0 ) -[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="Tentacle/Hitbox"] +[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="Tentacle/Hurtbox"] polygon = PoolVector2Array( 202, 11, 430, 2, 666, 10, 880, 40, 1008, 76, 1019, 100, 992, 121, 336, 163, 8, 200, 9, 34 ) [node name="Sprite" type="Sprite" parent="."] @@ -43,7 +43,7 @@ __meta__ = { } [node name="AnimationPlayer" type="AnimationPlayer" parent="."] -anims/Stab = SubResource( 2 ) +anims/Stab = SubResource( 1 ) [node name="Timer" type="Timer" parent="."] wait_time = 3.0 @@ -57,5 +57,12 @@ visible = false [node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="Hitbox"] polygon = PoolVector2Array( 131, 9, 234, 56, 364, 67, 413, 149, 592, 41, 699, 37, 779, 65, 835, 93, 863, 144, 701, 177, 731, 252, 746, 331, 731, 405, 684, 477, 801, 528, 846, 694, 917, 775, 979, 770, 1207, 512, 1280, 498, 1285, 518, 1191, 596, 1123, 773, 1079, 832, 1231, 815, 1355, 875, 1415, 973, 1407, 1022, 1321, 943, 1120, 926, 903, 961, 1031, 1045, 1052, 1078, -1, 1081, 4, 179, 70, 30 ) -[connection signal="area_entered" from="Tentacle/Hitbox" to="." method="_on_Hitbox_area_entered"] +[node name="DeadEye" type="Sprite" parent="."] +visible = false +position = Vector2( 466, 741 ) +texture = ExtResource( 4 ) + +[node name="TweenSpawn" type="Tween" parent="."] + +[connection signal="area_entered" from="Tentacle/Hurtbox" to="." method="_on_Hurtbox_area_entered"] [connection signal="timeout" from="Timer" to="." method="_on_Timer_timeout"] diff --git a/Travesty/Tank/Tank.gd b/Travesty/Tank/Tank.gd index a854703..d3c4ac4 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, POISON, KNIFE, SQUID, HEATER, ANGLER, NEXT } +enum Phase { START, CLEAN, KNIFE, HEATER, POISON, SQUID, ANGLER, NEXT } var phase = Phase.START @@ -14,8 +14,13 @@ func _ready() -> void: func _input(event: InputEvent) -> void: +# if event.is_action_pressed("skip"): +# blackout() #glitchy af, don't use unless I refactor code entirely if event is InputEventMouseButton and event.button_index == BUTTON_LEFT and event.pressed: - $Fish.fire_pellet() # Fire a pellet if appropriate and able + if $Fish.dash_mutation: + $Fish.dash() + elif $Fish.poison_mutation: + $Fish.fire_pellet() # Fire a pellet if appropriate and able static func random_position(area: CollisionShape2D) -> Vector2: @@ -47,17 +52,30 @@ func blackout() -> void: next_phase() $House/HouseEyes.visible = false $House/HouseRight.z_index = $House/HouseLeft.z_index - print(phase) - if phase == Phase.POISON: - $SurviveTimer.start() - if phase == Phase.KNIFE: - var fork_scene = load("res://Hazards/Fork/Fork.tscn") - var fork = fork_scene.instance() - add_child(fork) if phase == Phase.SQUID: var squid_scene = load("res://Hazards/Squid/Squid.tscn") var squid = squid_scene.instance() add_child(squid) + 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 + if phase == Phase.POISON: + $SurviveTimer.start() + 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) + if phase == Phase.KNIFE: + var fork_scene = load("res://Hazards/Fork/Fork.tscn") + var fork = fork_scene.instance() + add_child(fork) if not phase == Phase.CLEAN: $Fish.position = $House/RightEntrance.get_global_position() + Vector2(0,-100) $Fish.global_rotation_degrees = 180 @@ -69,7 +87,10 @@ func blackout() -> void: $TweenBlackout.interpolate_property(self, "modulate", modulate, Color(1,1,1,1), 2, Tween.TRANS_LINEAR, Tween.EASE_IN) $TweenBlackout.start() yield($TweenBlackout, "tween_completed") - $Fish.invincible = false + + if not phase == Phase.KNIFE: + $Fish.invincible = false + _think() @@ -93,11 +114,21 @@ func _think() -> void: thought.bbcode_text = \ "\n[center][tornado]ooOOoo! " + \ "Does it really rain yummy treats in here? :D" - if phase == Phase.POISON: + elif phase == Phase.POISON: $Fish/ThoughtBubble.visible = true thought.bbcode_text = \ - "[center]Wait, something's wrong with these flakes!\n" + \ + "\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.SQUID: + $Fish/ThoughtBubble.visible = true + thought.bbcode_text = \ + "[center]HOLY...! Wait a minute; I've got an idea!\n" + \ + "([rainbow]TAIL CANNON[/rainbow] unlocked!)" # Tween the $Thought.bbcode_text's percent_visible property diff --git a/Travesty/Tank/Tank.tscn b/Travesty/Tank/Tank.tscn index bf4ec70..b35209e 100644 --- a/Travesty/Tank/Tank.tscn +++ b/Travesty/Tank/Tank.tscn @@ -1,13 +1,15 @@ -[gd_scene load_steps=13 format=2] +[gd_scene load_steps=15 format=2] [ext_resource path="res://Tank/Water.png" type="Texture" id=1] [ext_resource path="res://Tank/Tank.gd" type="Script" id=2] +[ext_resource path="res://Tank/Water_Surface.png" type="Texture" id=3] [ext_resource path="res://Fish/Fish.tscn" type="PackedScene" id=4] [ext_resource path="res://Tank/Gravel.png" type="Texture" id=5] [ext_resource path="res://Tank/Travis.png" type="Texture" id=6] [ext_resource path="res://Tank/House_Left_B.png" type="Texture" id=7] [ext_resource path="res://Tank/House_Eyes.png" type="Texture" id=8] [ext_resource path="res://Tank/House_Right_B.png" type="Texture" id=9] +[ext_resource path="res://Hazards/Fork/FishFork.png" type="Texture" id=10] [sub_resource type="RectangleShape2D" id=1] extents = Vector2( 20, 540 ) @@ -44,8 +46,13 @@ centered = false margin_right = 1920.0 margin_bottom = 100.0 color = Color( 0.588235, 0.588235, 0.980392, 1 ) +__meta__ = { +"_edit_use_anchors_": false +} -[node name="Edges" type="StaticBody2D" parent="." groups=["Tank"]] +[node name="Edges" type="StaticBody2D" parent="." groups=[ +"Tank", +]] visible = false collision_layer = 4 collision_mask = 18 @@ -74,20 +81,32 @@ autostart = true collision_layer = 8 collision_mask = 2 +[node name="TankTop" type="Sprite" parent="Surface"] +texture = ExtResource( 3 ) +centered = false + [node name="WaterSurface" type="CollisionShape2D" parent="Surface"] position = Vector2( 960, 88 ) shape = SubResource( 2 ) -[node name="ColorRect" type="ColorRect" parent="Surface"] -margin_top = 95.0 +[node name="TankTopRim" type="Node2D" parent="Surface"] +z_index = 5 + +[node name="ColorRect" type="ColorRect" parent="Surface/TankTopRim"] +margin_top = 86.0 margin_right = 1920.0 -margin_bottom = 115.0 -color = Color( 0.588235, 0.588235, 0.980392, 1 ) +margin_bottom = 124.0 +color = Color( 0, 0, 0, 1 ) +__meta__ = { +"_edit_use_anchors_": false +} [node name="Fish" parent="." instance=ExtResource( 4 )] position = Vector2( 617, 494 ) -[node name="TankFloor" type="Area2D" parent="." groups=["TankFloor"]] +[node name="TankFloor" type="Area2D" parent="." groups=[ +"TankFloor", +]] visible = false position = Vector2( 960, 1070 ) @@ -132,5 +151,10 @@ position = Vector2( 160, 245 ) wait_time = 10.0 one_shot = true +[node name="FishFork" type="Sprite" parent="."] +visible = false +position = Vector2( 1049, 867 ) +texture = ExtResource( 10 ) + [connection signal="timeout" from="HazardSpawner/HazardTimer" to="." method="_on_HazardTimer_timeout"] [connection signal="timeout" from="SurviveTimer" to="." method="_on_SurviveTimer_timeout"] diff --git a/Travesty/Tank/Water_Surface.png b/Travesty/Tank/Water_Surface.png new file mode 100644 index 0000000..f5f1bd2 Binary files /dev/null and b/Travesty/Tank/Water_Surface.png differ diff --git a/Travesty/Tank/Water_Surface.png.import b/Travesty/Tank/Water_Surface.png.import new file mode 100644 index 0000000..1b081c6 --- /dev/null +++ b/Travesty/Tank/Water_Surface.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/Water_Surface.png-d0c80c67a87f4c20c76ff21635cdc9c4.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Tank/Water_Surface.png" +dest_files=[ "res://.import/Water_Surface.png-d0c80c67a87f4c20c76ff21635cdc9c4.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=true +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/Travesty/project.godot b/Travesty/project.godot index a044d12..35cb097 100644 --- a/Travesty/project.godot +++ b/Travesty/project.godot @@ -24,9 +24,9 @@ window/stretch/aspect="keep" [input] -dash={ +skip={ "deadzone": 0.5, -"events": [ Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"button_mask":0,"position":Vector2( 0, 0 ),"global_position":Vector2( 0, 0 ),"factor":1.0,"button_index":1,"pressed":false,"doubleclick":false,"script":null) +"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":90,"unicode":0,"echo":false,"script":null) ] }