27 lines
744 B
GDScript
27 lines
744 B
GDScript
extends Control
|
|
|
|
const MENU := "res://scenes/ui/main_menu.tscn"
|
|
@onready var video: VideoStreamPlayer = $VideoAspect/Video
|
|
var _finished := false
|
|
|
|
func _ready() -> void:
|
|
video.finished.connect(_finish_intro)
|
|
video.play()
|
|
|
|
func _input(event: InputEvent) -> void:
|
|
if event is InputEventKey and event.pressed and not event.echo and (event.physical_keycode == KEY_SPACE or event.keycode == KEY_SPACE):
|
|
get_viewport().set_input_as_handled()
|
|
_finish_intro()
|
|
|
|
func _finish_intro() -> void:
|
|
if _finished:
|
|
return
|
|
_finished = true
|
|
video.stop()
|
|
_open_menu.call_deferred()
|
|
|
|
func _open_menu() -> void:
|
|
var error := get_tree().change_scene_to_file(MENU)
|
|
if error != OK:
|
|
push_error("Nie udało się otworzyć menu: %s" % error_string(error))
|