Added angler

This commit is contained in:
Skip 2022-07-17 14:06:20 -04:00
parent f57a52d5fc
commit 687480fe89
2 changed files with 82 additions and 0 deletions

View File

@ -0,0 +1,45 @@
extends Node2D
export var hp : int = 3 # Number of hits before dying
export var dash_duration : int = 3 # Duration of charge tween in seconds
onready var fish = get_node("/root/Tank/Fish")
func _ready():
pass
func _process(delta: float) -> void:
# look at fish like how Fish.tscn looks at get_global_mouse_position() in Fish.gd's _process
pass
func _on_ChargeTimer_timeout() -> void:
# $Tween self toward fish.get_global_position()
$Tween.interpolate_property(self, "position", get_global_position(), fish.get_global_position(), dash_duration, Tween.TRANS_CIRC, Tween.EASE_OUT_IN)
pass
func _on_Hurtbox_area_entered(area: Area2D) -> void:
if area.is_in_group("Fish"):
if fish.electrified:
fish.belly_up("a concussion")
func _on_Hitbox_area_entered(area: Area2D) -> void:
if area.is_in_group("Fish"):
if fish.electrified:
hp -= 1
if hp < 1: # kill angler
_death()
else: # damage angler
# Modulate self across all white > yellow > black and maybe?
$TweenColor.interpolate_property(self, "modulate", modulate, Color(0,0,0,1))
$Tween.start()
func _death():
# do something to make it obvious he died
# probably replacing his eyes with X_X's
# flipping him upside-down, maybe like: $AnimatedSprite.flip_v = true
# floating him to top ($Tween probably)
pass

View File

@ -0,0 +1,37 @@
[gd_scene load_steps=4 format=2]
[ext_resource path="res://Hazards/Angler/Angler.gd" type="Script" id=1]
[ext_resource path="res://Hazards/Angler/Angler.png" type="Texture" id=2]
[sub_resource type="CapsuleShape2D" id=1]
radius = 25.0
height = 108.0
[node name="Angler" type="Node2D"]
script = ExtResource( 1 )
[node name="Sprite" type="Sprite" parent="."]
position = Vector2( 16, -16 )
scale = Vector2( 0.5, 0.5 )
texture = ExtResource( 2 )
[node name="Tween" type="Tween" parent="."]
[node name="ChargeTimer" type="Timer" parent="."]
wait_time = 4.0
[node name="Hitbox" type="Area2D" parent="."]
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="Hitbox"]
polygon = PoolVector2Array( -75, -15, -33, -47, -7, -55, 22, -54, 79, -32, 107, -14, 123, -31, 136, -34, 145, -31, 133, -25, 130, -15, 141, -4, 128, -2, 137, 15, 121, 9, 109, -2, 21, 48, -16, 53, -43, 47, -64, 32, -76, 9 )
[node name="Hurtbox" type="Area2D" parent="."]
[node name="CollisionShape2D" type="CollisionShape2D" parent="Hurtbox"]
position = Vector2( 10, -3 )
rotation = 1.5708
shape = SubResource( 1 )
[connection signal="timeout" from="ChargeTimer" to="." method="_on_ChargeTimer_timeout"]
[connection signal="area_entered" from="Hitbox" to="." method="_on_Hitbox_area_entered"]
[connection signal="area_entered" from="Hurtbox" to="." method="_on_Hurtbox_area_entered"]