-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.gd
45 lines (40 loc) · 1.38 KB
/
main.gd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
extends Control
func _ready() -> void:
Collectibles._main_viewport = $SubViewportContainer
Collectibles._collectible_viewport = $CollectibleDisplay
get_viewport().disable_3d = true
func _input(event: InputEvent) -> void:
if event is InputEventMouseButton:
if !event.pressed:
return
elif event is InputEventKey:
if !event.pressed:
return
elif event is InputEventJoypadButton:
if !event.pressed:
return
else:
return
var camera: Camera3D = $SubViewportContainer/SubViewport/Camera3D
set_process_input(false)
await create_tween().tween_property(camera, "position:z", 0, 3.5).set_trans(Tween.TRANS_QUAD).finished
var title: AnimatedSprite3D = $SubViewportContainer/SubViewport/Title
title.queue_free()
var intro_level: Level = $SubViewportContainer/SubViewport/Intro
var player: Player = preload("res://player/player.tscn").instantiate()
player.add_child(AudioListener3D.new(), true)
player.position = intro_level.get_player_spawnpoint()
$SubViewportContainer/SubViewport.add_child(player)
var hud := preload("res://player/hud.tscn").instantiate()
hud.player = player
hud.pause_menu_visibility.connect(
func(pause_visible: bool):
if pause_visible:
$HUD.mouse_filter = MOUSE_FILTER_STOP
else:
$HUD.mouse_filter = MOUSE_FILTER_IGNORE
)
await player.appeared
intro_level.set_player(player)
intro_level.set_camera(camera)
$HUD/SubViewport.add_child(hud)