2024-01-30 04:05:17 +01:00
|
|
|
extends Node2D
|
|
|
|
var boss
|
2024-03-06 20:48:56 +01:00
|
|
|
var player
|
2024-01-30 04:05:17 +01:00
|
|
|
|
|
|
|
# Called when the node enters the scene tree for the first time.
|
|
|
|
func _ready():
|
|
|
|
boss = $Lily
|
2024-03-06 20:48:56 +01:00
|
|
|
player = $Player
|
2024-01-30 04:05:17 +01:00
|
|
|
boss.add_to_group("boss")
|
|
|
|
|
|
|
|
|
|
|
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
|
|
|
func _process(delta):
|
2024-03-09 02:50:47 +01:00
|
|
|
pass
|
|
|
|
|
|
|
|
func _physics_process(delta):
|
|
|
|
if player.velocity.x >= 0 && player.velocity.y >= 0:
|
|
|
|
if player.position.y < boss.position.y && player.get_index() > boss.get_index():
|
|
|
|
move_child(player, boss.get_index() - 1)
|
|
|
|
print("move up")
|
|
|
|
elif player.position.y > boss.position.y && player.get_index() < boss.get_index():
|
|
|
|
move_child(player, boss.get_index() + 1)
|
|
|
|
print("move down")
|