Hsif/Scripts/GoldenBait.gd

38 lines
666 B
GDScript

extends Area2D
var bigBoss = Node
@export
var target = 0
@export
var ai = 0
@export
var speed = 1
# Called when the node enters the scene tree for the first time.
func _ready():
bigBoss = get_tree().get_first_node_in_group("BigBoss")
match ai:
#set position
0:
position = Vector2(0, -1087)
#fish position
1:
position = Vector2(0,-1087)
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _physics_process(delta):
goFish()
func goFish():
if position.y < 0:
position.y = position.y + speed
func _on_body_entered(body):
if body.is_in_group("Fish"):
bigBoss.switch = true
bigBoss.scene = 2
queue_free()