29 lines
714 B
GDScript
29 lines
714 B
GDScript
extends Node2D
|
|
|
|
|
|
func _ready():
|
|
$Timer.start()
|
|
|
|
|
|
func _on_Hitbox_area_entered(area: Area2D) -> void:
|
|
if area.is_in_group("Fish"):
|
|
area.kill()
|
|
|
|
|
|
func _on_Timer_timeout():
|
|
_reposition()
|
|
yield($Tween, "tween_completed")
|
|
$AnimationPlayer.play("Stab")
|
|
yield($AnimationPlayer, "animation_finished")
|
|
$AnimationPlayer.play_backwards("Stab")
|
|
yield($AnimationPlayer, "animation_finished")
|
|
$Timer.wait_time = rand_range(.3,1.5)
|
|
$Timer.start()
|
|
|
|
|
|
func _reposition() -> void:
|
|
var tween_duration = rand_range(.3,1.5)
|
|
$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")
|