Start
Core proof of concept mechanics implemented.
52
Travesty/Fish/Fish.gd
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
extends KinematicBody2D
|
||||||
|
export var swim_length = 150
|
||||||
|
export var swim_cooldown = 1
|
||||||
|
|
||||||
|
var destination # The position the fish will move to _on_SwimTimer_timeout()
|
||||||
|
|
||||||
|
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 pellets = 0 # Tracks the number of poison pellets eaten but not shot yet
|
||||||
|
onready var mouth = $Positions/Mouth.position # Used for eating poison pellets
|
||||||
|
onready var mouth_inhale = $Positions/MouthInhale.position
|
||||||
|
onready var tail = $Positions/Booty
|
||||||
|
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
$SwimTimer.wait_time = swim_cooldown
|
||||||
|
|
||||||
|
func _on_SwimTimer_timeout() -> void:
|
||||||
|
# Swim toward mouse
|
||||||
|
destination = Vector2(move_toward(position.x, get_global_mouse_position().x, swim_length), move_toward(position.y, get_global_mouse_position().y, swim_length))
|
||||||
|
$Tween.interpolate_property(self, "position", position, destination, 1, Tween.TRANS_CUBIC, Tween.EASE_IN_OUT)
|
||||||
|
$Tween.start()
|
||||||
|
|
||||||
|
|
||||||
|
func _process(delta: float) -> void:
|
||||||
|
if destination:
|
||||||
|
# Smoothly rotate Fish to face mouse
|
||||||
|
var v = get_global_mouse_position() - global_position
|
||||||
|
var angle = v.angle() + deg2rad(270)
|
||||||
|
if rad2deg(angle) < 180 or rad2deg(angle) > 360:
|
||||||
|
$Sprite.flip_v = true
|
||||||
|
else:
|
||||||
|
$Sprite.flip_v = false
|
||||||
|
var rotation_speed = PI * 0.75 # PI = 180 degrees
|
||||||
|
var angle_delta = rotation_speed * delta
|
||||||
|
angle = lerp_angle(global_rotation, angle + 1.57, 1.0)
|
||||||
|
angle = clamp(angle, global_rotation - angle_delta, global_rotation + angle_delta)
|
||||||
|
global_rotation = angle
|
||||||
|
|
||||||
|
|
||||||
|
func _fire_pellet() -> void:
|
||||||
|
if pellets > 0:
|
||||||
|
var poison_scene = load("res://Hazards/Poison/Poison.tscn")
|
||||||
|
var poison = poison_scene.instance()
|
||||||
|
add_child(poison)
|
||||||
|
poison.position = position
|
||||||
|
#poison.direction = position.angle_to_point(mouth)
|
||||||
|
poison.applied_force = Vector2(mouth.get_global_position(), tail.get_global_position())
|
||||||
|
|
||||||
|
|
||||||
|
func kill(cause: String) -> void:
|
||||||
|
queue_free()
|
BIN
Travesty/Fish/Fish.png
Normal file
After Width: | Height: | Size: 200 KiB |
35
Travesty/Fish/Fish.png.import
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="StreamTexture"
|
||||||
|
path="res://.import/Fish.png-744f11a55bf4954d06d11cec5badea9c.stex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://Fish/Fish.png"
|
||||||
|
dest_files=[ "res://.import/Fish.png-744f11a55bf4954d06d11cec5badea9c.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
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
stream=false
|
||||||
|
size_limit=0
|
||||||
|
detect_3d=true
|
||||||
|
svg/scale=1.0
|
53
Travesty/Fish/Fish.tscn
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
[gd_scene load_steps=5 format=2]
|
||||||
|
|
||||||
|
[ext_resource path="res://Fish/Fish.png" type="Texture" id=1]
|
||||||
|
[ext_resource path="res://Fish/Fish.gd" type="Script" id=2]
|
||||||
|
|
||||||
|
[sub_resource type="CapsuleShape2D" id=1]
|
||||||
|
radius = 17.0
|
||||||
|
height = 88.0
|
||||||
|
|
||||||
|
[sub_resource type="CapsuleShape2D" id=2]
|
||||||
|
radius = 21.0
|
||||||
|
height = 100.0
|
||||||
|
|
||||||
|
[node name="Fish" type="KinematicBody2D"]
|
||||||
|
collision_layer = 2
|
||||||
|
collision_mask = 28
|
||||||
|
script = ExtResource( 2 )
|
||||||
|
|
||||||
|
[node name="Sprite" type="Sprite" parent="."]
|
||||||
|
position = Vector2( -26, 7 )
|
||||||
|
scale = Vector2( 0.1, 0.1 )
|
||||||
|
texture = ExtResource( 1 )
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||||
|
visible = false
|
||||||
|
position = Vector2( -18, 3 )
|
||||||
|
rotation = 1.5708
|
||||||
|
shape = SubResource( 1 )
|
||||||
|
|
||||||
|
[node name="Hitbox" type="Area2D" parent="." groups=["Fish"]]
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="Hitbox"]
|
||||||
|
position = Vector2( -18, 3 )
|
||||||
|
rotation = 1.5708
|
||||||
|
shape = SubResource( 2 )
|
||||||
|
|
||||||
|
[node name="SwimTimer" type="Timer" parent="."]
|
||||||
|
autostart = true
|
||||||
|
|
||||||
|
[node name="Tween" type="Tween" parent="."]
|
||||||
|
|
||||||
|
[node name="Positions" type="Node2D" parent="."]
|
||||||
|
|
||||||
|
[node name="Mouth" type="Position2D" parent="Positions"]
|
||||||
|
position = Vector2( 50, 13 )
|
||||||
|
|
||||||
|
[node name="MouthInhale" type="Position2D" parent="Positions"]
|
||||||
|
position = Vector2( 79, 15 )
|
||||||
|
|
||||||
|
[node name="Tail" type="Position2D" parent="Positions"]
|
||||||
|
position = Vector2( -72, 0 )
|
||||||
|
|
||||||
|
[connection signal="timeout" from="SwimTimer" to="." method="_on_SwimTimer_timeout"]
|
32
Travesty/Hazards/Fork/Fork.gd
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
extends Sprite
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
|
||||||
|
for i in 10000:
|
||||||
|
# $Tween.interpolate_property(self, "region_rect:position:y", region_rect.position.y, region_rect.position.y-200, 1, Tween.TRANS_CIRC, Tween.EASE_OUT)
|
||||||
|
# $Tween.interpolate_property($ForkAbove, "region_rect:position:y", 410, 200, 1, Tween.TRANS_CIRC, Tween.EASE_OUT)
|
||||||
|
# $Tween.start()
|
||||||
|
# yield($Tween,"tween_completed")
|
||||||
|
$Tween.interpolate_property(self, "region_rect:position:y", -500, 0, 1.5, Tween.TRANS_CIRC, Tween.EASE_OUT)
|
||||||
|
$Tween.interpolate_property($ForkAbove, "region_rect:position:y", -90, 410, 1.5, Tween.TRANS_CIRC, Tween.EASE_OUT)
|
||||||
|
$Tween.start()
|
||||||
|
yield($Tween,"tween_completed")
|
||||||
|
region_rect.position.y = 0
|
||||||
|
$ForkAbove.region_rect.position.y = 410
|
||||||
|
|
||||||
|
# $AnimationPlayer.play("Stab")
|
||||||
|
|
||||||
|
|
||||||
|
# rotateTween.interpolate_property( # rotateTween is the name of the Tween node. This is telling Godot to create a new animation using this Tween node object.
|
||||||
|
# hexagonTile, # hexagonTile is the 3D tile we want to animate.
|
||||||
|
# "rotation_degrees:y", # When the Tween runs its animation, we will change the Y value on the tile's rotation.
|
||||||
|
# rotation_degrees.y, # When the Tween runs its animation, it will start at the tile's current rotation.
|
||||||
|
# rotation_degrees.y+60 # When the Tween runs its animation, it will end at 60 degrees clockwise from the tile's last rotation.
|
||||||
|
# 0.25, # This is the amount of time in seconds you want the Tween to run the animation for. This means that on the first run,
|
||||||
|
# # the Tween's animation will rotate the tile from 0 degrees to 60 degrees in 1/4 of a second.
|
||||||
|
# Tween.TRANS_BACK, # This is the animations's "TransitionType". I'll talk about this in the next section.
|
||||||
|
# Tween.EASE_OUT # This is the animation's "EaseType". I'll talk about this in the next section.
|
||||||
|
#)
|
||||||
|
|
||||||
|
#func _rewind():
|
||||||
|
# $AnimationPlayer.play_backwards("Stab")
|
BIN
Travesty/Hazards/Fork/Fork.png
Normal file
After Width: | Height: | Size: 33 KiB |
35
Travesty/Hazards/Fork/Fork.png.import
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="StreamTexture"
|
||||||
|
path="res://.import/Fork.png-cbf4b4f4bf0d3fbafc4b15befe8b07fd.stex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://Hazards/Fork/Fork.png"
|
||||||
|
dest_files=[ "res://.import/Fork.png-cbf4b4f4bf0d3fbafc4b15befe8b07fd.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
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
stream=false
|
||||||
|
size_limit=0
|
||||||
|
detect_3d=true
|
||||||
|
svg/scale=1.0
|
21
Travesty/Hazards/Fork/Fork.tscn
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
[gd_scene load_steps=3 format=2]
|
||||||
|
|
||||||
|
[ext_resource path="res://Hazards/Fork/Fork.gd" type="Script" id=1]
|
||||||
|
[ext_resource path="res://Hazards/Fork/Fork.png" type="Texture" id=2]
|
||||||
|
|
||||||
|
[node name="Fork" type="Sprite"]
|
||||||
|
position = Vector2( 550, 577 )
|
||||||
|
rotation = 3.14159
|
||||||
|
scale = Vector2( 2, 2 )
|
||||||
|
texture = ExtResource( 2 )
|
||||||
|
region_enabled = true
|
||||||
|
region_rect = Rect2( 0, 0, 300, 470 )
|
||||||
|
script = ExtResource( 1 )
|
||||||
|
|
||||||
|
[node name="ForkAbove" type="Sprite" parent="."]
|
||||||
|
position = Vector2( 216.5, 286 )
|
||||||
|
texture = ExtResource( 2 )
|
||||||
|
region_enabled = true
|
||||||
|
region_rect = Rect2( 200, 410, 300, 100 )
|
||||||
|
|
||||||
|
[node name="Tween" type="Tween" parent="."]
|
48
Travesty/Hazards/Poison/Poison.gd
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
extends RigidBody2D
|
||||||
|
|
||||||
|
export var poisoned_color : Color = Color(0,200,0,255)
|
||||||
|
var fish : Node
|
||||||
|
var direction
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
fish = get_node("/root/Tank/Fish")
|
||||||
|
$AnimatedSprite.frame = choose([0,1,2])
|
||||||
|
|
||||||
|
|
||||||
|
func _on_Hitbox_area_entered(area: Area2D) -> void:
|
||||||
|
if area.is_in_group("Fish") and fish.poisoned == false and not fish.poison_mutation:
|
||||||
|
print("A poison pellet has inflicted poison on the fish.")
|
||||||
|
fish.poisoned = true
|
||||||
|
visible = false
|
||||||
|
$Timer.start()
|
||||||
|
$TweenPoison.interpolate_property(area.get_parent(), "modulate", modulate, poisoned_color, 2.0, Tween.TRANS_LINEAR, Tween.EASE_IN)
|
||||||
|
$TweenPoison.start()
|
||||||
|
elif area.is_in_group("Fish") and fish.poison_mutation and fish.pellets < 10:
|
||||||
|
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()
|
||||||
|
print(get_node("/root/Tank/Fish/Positions/Mouth").get_global_position())
|
||||||
|
yield($TweenEat, "tween_completed")
|
||||||
|
queue_free()
|
||||||
|
|
||||||
|
|
||||||
|
static func choose(choices):
|
||||||
|
return choices[randi() % choices.size()]
|
||||||
|
|
||||||
|
|
||||||
|
func _on_Timer_timeout() -> void:
|
||||||
|
if fish:
|
||||||
|
print("Fish died of poison.")
|
||||||
|
fish.kill("poison")
|
||||||
|
|
||||||
|
|
||||||
|
func _on_Hitbox_area_exited(area: Area2D) -> void:
|
||||||
|
if area.is_in_group("Tank"):
|
||||||
|
queue_free()
|
||||||
|
|
||||||
|
|
||||||
|
#func _process(delta: float) -> void:
|
||||||
|
# if direction:
|
||||||
|
|
52
Travesty/Hazards/Poison/Poison.tscn
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
[gd_scene load_steps=8 format=2]
|
||||||
|
|
||||||
|
[ext_resource path="res://Hazards/Poison/PoisonFood3.png" type="Texture" id=1]
|
||||||
|
[ext_resource path="res://Hazards/Poison/PoisonFood1.png" type="Texture" id=2]
|
||||||
|
[ext_resource path="res://Hazards/Poison/PoisonFood2.png" type="Texture" id=3]
|
||||||
|
[ext_resource path="res://Hazards/Poison/Poison.gd" type="Script" id=4]
|
||||||
|
|
||||||
|
[sub_resource type="SpriteFrames" id=1]
|
||||||
|
animations = [ {
|
||||||
|
"frames": [ ExtResource( 2 ), ExtResource( 3 ), ExtResource( 1 ) ],
|
||||||
|
"loop": true,
|
||||||
|
"name": "default",
|
||||||
|
"speed": 5.0
|
||||||
|
} ]
|
||||||
|
|
||||||
|
[sub_resource type="RectangleShape2D" id=2]
|
||||||
|
extents = Vector2( 17.5, 19 )
|
||||||
|
|
||||||
|
[sub_resource type="RectangleShape2D" id=3]
|
||||||
|
extents = Vector2( 28, 25 )
|
||||||
|
|
||||||
|
[node name="Poison" type="RigidBody2D"]
|
||||||
|
self_modulate = Color( 0, 0.784314, 0, 1 )
|
||||||
|
collision_layer = 16
|
||||||
|
collision_mask = 6
|
||||||
|
script = ExtResource( 4 )
|
||||||
|
|
||||||
|
[node name="AnimatedSprite" type="AnimatedSprite" parent="."]
|
||||||
|
frames = SubResource( 1 )
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||||
|
position = Vector2( 1.5, 1 )
|
||||||
|
shape = SubResource( 2 )
|
||||||
|
|
||||||
|
[node name="Hitbox" type="Area2D" parent="."]
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="Hitbox"]
|
||||||
|
shape = SubResource( 3 )
|
||||||
|
|
||||||
|
[node name="Timer" type="Timer" parent="."]
|
||||||
|
wait_time = 2.0
|
||||||
|
one_shot = true
|
||||||
|
|
||||||
|
[node name="TweenPoison" type="Tween" parent="."]
|
||||||
|
|
||||||
|
[node name="TweenEat" type="Tween" parent="."]
|
||||||
|
|
||||||
|
[node name="TweenShoot" type="Tween" parent="."]
|
||||||
|
|
||||||
|
[connection signal="area_entered" from="Hitbox" to="." method="_on_Hitbox_area_entered"]
|
||||||
|
[connection signal="area_exited" from="Hitbox" to="." method="_on_Hitbox_area_exited"]
|
||||||
|
[connection signal="timeout" from="Timer" to="." method="_on_Timer_timeout"]
|
BIN
Travesty/Hazards/Poison/PoisonFood1.png
Normal file
After Width: | Height: | Size: 1018 B |
35
Travesty/Hazards/Poison/PoisonFood1.png.import
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="StreamTexture"
|
||||||
|
path="res://.import/PoisonFood1.png-d7a15315adea2a6df176ea5550539926.stex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://Hazards/Poison/PoisonFood1.png"
|
||||||
|
dest_files=[ "res://.import/PoisonFood1.png-d7a15315adea2a6df176ea5550539926.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
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
stream=false
|
||||||
|
size_limit=0
|
||||||
|
detect_3d=true
|
||||||
|
svg/scale=1.0
|
BIN
Travesty/Hazards/Poison/PoisonFood2.png
Normal file
After Width: | Height: | Size: 921 B |
35
Travesty/Hazards/Poison/PoisonFood2.png.import
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="StreamTexture"
|
||||||
|
path="res://.import/PoisonFood2.png-3636c377e3c1cf8d9f5c830e8a1548b9.stex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://Hazards/Poison/PoisonFood2.png"
|
||||||
|
dest_files=[ "res://.import/PoisonFood2.png-3636c377e3c1cf8d9f5c830e8a1548b9.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
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
stream=false
|
||||||
|
size_limit=0
|
||||||
|
detect_3d=true
|
||||||
|
svg/scale=1.0
|
BIN
Travesty/Hazards/Poison/PoisonFood3.png
Normal file
After Width: | Height: | Size: 874 B |
35
Travesty/Hazards/Poison/PoisonFood3.png.import
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="StreamTexture"
|
||||||
|
path="res://.import/PoisonFood3.png-11c6a73cd35f562c010a7a89c4aaaf7f.stex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://Hazards/Poison/PoisonFood3.png"
|
||||||
|
dest_files=[ "res://.import/PoisonFood3.png-11c6a73cd35f562c010a7a89c4aaaf7f.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
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
stream=false
|
||||||
|
size_limit=0
|
||||||
|
detect_3d=true
|
||||||
|
svg/scale=1.0
|
BIN
Travesty/Tank/AquariumBG.jpg
Normal file
After Width: | Height: | Size: 461 KiB |
35
Travesty/Tank/AquariumBG.jpg.import
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="StreamTexture"
|
||||||
|
path="res://.import/AquariumBG.jpg-2298e7d1c50d8227b33cf0fcf177f2b1.stex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://Tank/AquariumBG.jpg"
|
||||||
|
dest_files=[ "res://.import/AquariumBG.jpg-2298e7d1c50d8227b33cf0fcf177f2b1.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
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
stream=false
|
||||||
|
size_limit=0
|
||||||
|
detect_3d=true
|
||||||
|
svg/scale=1.0
|
27
Travesty/Tank/Tank.gd
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
extends Node2D
|
||||||
|
|
||||||
|
func _ready() -> void:
|
||||||
|
randomize()
|
||||||
|
var keyscene = load("res://Star/Star.tscn")
|
||||||
|
var keyspawns = get_tree().get_nodes_in_group("KeySpawners")
|
||||||
|
for keyspawn in keyspawns:
|
||||||
|
var key = keyscene.instance()
|
||||||
|
key.position = random_position(keyspawn)
|
||||||
|
add_child(key)
|
||||||
|
|
||||||
|
|
||||||
|
static func random_position(area: CollisionShape2D) -> Vector2:
|
||||||
|
# Returns a random position found within the given CollisionShape2D.
|
||||||
|
var _topleft : Vector2 = area.global_position - area.shape.extents
|
||||||
|
var _botright : Vector2 = area.global_position + area.shape.extents
|
||||||
|
var _x = rand_range(_topleft.x, _botright.x)
|
||||||
|
var _y = rand_range(_topleft.y, _botright.y)
|
||||||
|
return Vector2(_x, _y)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
func _on_HazardTimer_timeout() -> void:
|
||||||
|
var poison_scene = load("res://Hazards/Poison/Poison.tscn")
|
||||||
|
var poison = poison_scene.instance()
|
||||||
|
add_child(poison)
|
||||||
|
poison.position = random_position($HazardSpawner)
|
67
Travesty/Tank/Tank.tscn
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
[gd_scene load_steps=8 format=2]
|
||||||
|
|
||||||
|
[ext_resource path="res://Tank/AquariumBG.jpg" type="Texture" id=1]
|
||||||
|
[ext_resource path="res://Tank/Tank.gd" type="Script" id=2]
|
||||||
|
[ext_resource path="res://Hazards/Fork/Fork.tscn" type="PackedScene" id=3]
|
||||||
|
[ext_resource path="res://Fish/Fish.tscn" type="PackedScene" id=4]
|
||||||
|
|
||||||
|
[sub_resource type="RectangleShape2D" id=1]
|
||||||
|
extents = Vector2( 20, 540 )
|
||||||
|
|
||||||
|
[sub_resource type="RectangleShape2D" id=2]
|
||||||
|
extents = Vector2( 960, 20 )
|
||||||
|
|
||||||
|
[sub_resource type="RectangleShape2D" id=3]
|
||||||
|
extents = Vector2( 860, 50 )
|
||||||
|
|
||||||
|
[node name="Tank" type="Node2D"]
|
||||||
|
script = ExtResource( 2 )
|
||||||
|
|
||||||
|
[node name="AquariumBg" type="Sprite" parent="."]
|
||||||
|
position = Vector2( 960, 540 )
|
||||||
|
texture = ExtResource( 1 )
|
||||||
|
|
||||||
|
[node name="Fork" parent="." instance=ExtResource( 3 )]
|
||||||
|
|
||||||
|
[node name="Edges" type="StaticBody2D" parent="." groups=["Tank"]]
|
||||||
|
collision_layer = 4
|
||||||
|
collision_mask = 18
|
||||||
|
|
||||||
|
[node name="LeftEdge" type="CollisionShape2D" parent="Edges"]
|
||||||
|
position = Vector2( 0, 540 )
|
||||||
|
shape = SubResource( 1 )
|
||||||
|
|
||||||
|
[node name="RightEdge" type="CollisionShape2D" parent="Edges"]
|
||||||
|
position = Vector2( 1920, 540 )
|
||||||
|
shape = SubResource( 1 )
|
||||||
|
|
||||||
|
[node name="BottomEdge" type="CollisionShape2D" parent="Edges"]
|
||||||
|
position = Vector2( 960, 1080 )
|
||||||
|
shape = SubResource( 2 )
|
||||||
|
|
||||||
|
[node name="HazardSpawner" type="CollisionShape2D" parent="."]
|
||||||
|
position = Vector2( 960, -200 )
|
||||||
|
shape = SubResource( 3 )
|
||||||
|
|
||||||
|
[node name="HazardTimer" type="Timer" parent="HazardSpawner"]
|
||||||
|
wait_time = 0.5
|
||||||
|
autostart = true
|
||||||
|
|
||||||
|
[node name="Surface" type="StaticBody2D" parent="."]
|
||||||
|
collision_layer = 8
|
||||||
|
collision_mask = 2
|
||||||
|
|
||||||
|
[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
|
||||||
|
margin_right = 1920.0
|
||||||
|
margin_bottom = 115.0
|
||||||
|
color = Color( 0.588235, 0.588235, 0.980392, 1 )
|
||||||
|
|
||||||
|
[node name="Fish" parent="." instance=ExtResource( 4 )]
|
||||||
|
position = Vector2( 596, 543 )
|
||||||
|
|
||||||
|
[connection signal="timeout" from="HazardSpawner/HazardTimer" to="." method="_on_HazardTimer_timeout"]
|
7
Travesty/default_env.tres
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
[gd_resource type="Environment" load_steps=2 format=2]
|
||||||
|
|
||||||
|
[sub_resource type="ProceduralSky" id=1]
|
||||||
|
|
||||||
|
[resource]
|
||||||
|
background_mode = 2
|
||||||
|
background_sky = SubResource( 1 )
|
BIN
Travesty/icon.png
Normal file
After Width: | Height: | Size: 3.2 KiB |
35
Travesty/icon.png.import
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="StreamTexture"
|
||||||
|
path="res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://icon.png"
|
||||||
|
dest_files=[ "res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.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
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
stream=false
|
||||||
|
size_limit=0
|
||||||
|
detect_3d=true
|
||||||
|
svg/scale=1.0
|
38
Travesty/project.godot
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
; Engine configuration file.
|
||||||
|
; It's best edited using the editor UI and not directly,
|
||||||
|
; since the parameters that go here are not all obvious.
|
||||||
|
;
|
||||||
|
; Format:
|
||||||
|
; [section] ; section goes between []
|
||||||
|
; param=value ; assign values to parameters
|
||||||
|
|
||||||
|
config_version=4
|
||||||
|
|
||||||
|
[application]
|
||||||
|
|
||||||
|
config/name="Travesty"
|
||||||
|
run/main_scene="res://Tank/Tank.tscn"
|
||||||
|
config/icon="res://icon.png"
|
||||||
|
|
||||||
|
[display]
|
||||||
|
|
||||||
|
window/size/width=1920
|
||||||
|
window/size/height=1080
|
||||||
|
window/size/resizable=false
|
||||||
|
window/stretch/mode="2d"
|
||||||
|
window/stretch/aspect="keep"
|
||||||
|
|
||||||
|
[layer_names]
|
||||||
|
|
||||||
|
2d_physics/layer_2="Fish"
|
||||||
|
2d_physics/layer_3="Tank"
|
||||||
|
2d_physics/layer_4="Surface"
|
||||||
|
2d_physics/layer_5="Hazards"
|
||||||
|
|
||||||
|
[physics]
|
||||||
|
|
||||||
|
common/enable_pause_aware_picking=true
|
||||||
|
|
||||||
|
[rendering]
|
||||||
|
|
||||||
|
environment/default_environment="res://default_env.tres"
|