forked from newt/gmtk-2024
55 lines
1.5 KiB
GDScript
55 lines
1.5 KiB
GDScript
extends Node2D
|
|
|
|
@export var next_stage: String
|
|
|
|
@onready var right_border = $Borders/Right/CollisionShape2D
|
|
@onready var right_trigger = $Borders/Right/Trigger
|
|
@onready var intro_music = $BossIntroMusic
|
|
@onready var music_loop = $BossMusicLoop
|
|
@onready var go_arrow = $GoArrow
|
|
@onready var blink_timer = $BlinkTimer
|
|
@onready var hive_mind = $TheHiveMind
|
|
|
|
var go_arrow_blink_on = false
|
|
var completed = false
|
|
var intro_played = false
|
|
|
|
# Called when the node enters the scene tree for the first time.
|
|
func _ready() -> void:
|
|
go_arrow.hide()
|
|
|
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
|
func _process(delta: float) -> void:
|
|
# ----- Background Music (BG Media) ------
|
|
if !intro_played:
|
|
intro_played = true
|
|
intro_music.play()
|
|
if intro_played and !intro_music.playing and !completed:
|
|
if !music_loop.playing:
|
|
music_loop.play()
|
|
else:
|
|
music_loop.stop()
|
|
# ----------------------------------------
|
|
|
|
# ------ goeth the arrow bruv ------
|
|
if !completed:
|
|
completed = hive_mind.is_complete()
|
|
else:
|
|
toggle_go_arrow()
|
|
right_border.shape = null
|
|
right_trigger.body_entered.connect(_on_trigger)
|
|
# -------------- waow --------------
|
|
|
|
func toggle_go_arrow() -> void:
|
|
if blink_timer.is_stopped():
|
|
blink_timer.start()
|
|
if go_arrow_blink_on:
|
|
go_arrow.hide()
|
|
go_arrow_blink_on = false
|
|
else:
|
|
go_arrow.show()
|
|
go_arrow_blink_on = true
|
|
|
|
func _on_trigger(body: Node) -> void:
|
|
if body is Player:
|
|
get_tree().change_scene_to_file(next_stage)
|