midori-school/levels/Ceres/L20.gd

33 lines
1 KiB
GDScript3
Raw Permalink Normal View History

2024-04-17 20:33:27 +02:00
extends Node2D
var talk = load("res://levels/ui/talk.tscn").instantiate()
var boss
var player
# Called when the node enters the scene tree for the first time.
func _ready():
boss = $Kimberly
player = $Player
boss.add_to_group("boss")
Global.cdialog = [[tr("DIALOG_CERES_L20_0"), true, 0, 0], [tr("DIALOG_CERES_L20_1"), false, 3], [tr("DIALOG_CERES_L20_2"), true, 0, 0]]
Global.live = 0
get_tree().root.add_child.call(talk)
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
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")
func _input(event):
2024-06-17 23:08:25 +02:00
if Global.cdialog.size() != 0 && Global.live == 1:
2024-04-17 20:33:27 +02:00
get_tree().root.remove_child(talk)
2024-06-17 23:08:25 +02:00
Global.cdialog = []
2024-04-17 20:33:27 +02:00