46 lines
1.3 KiB
GDScript
46 lines
1.3 KiB
GDScript
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
|