-
Notifications
You must be signed in to change notification settings - Fork 0
/
MainMenu.gd
45 lines (34 loc) · 1.42 KB
/
MainMenu.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 Node3D
var time_to_reveal = 1
var time_to_close = 2
var is_closing = false
var basic_global_position_1
var basic_global_position_2
func _ready():
basic_global_position_1 = $MESH/MeshInstance3D.global_position
basic_global_position_2 = $MESH/MeshInstance3D2.global_position
$WorldEnvironment.environment.volumetric_fog_enabled = true
$MeshInstance2D.hide()
$MESH/MeshInstance3D.show()
$MESH/MeshInstance3D2.show()
$MeshInstance3D3.show()
$MESH.show()
$MESH2.show()
func _process(delta):
time_to_reveal -= delta
if time_to_reveal < 0:
$WorldEnvironment.environment.volumetric_fog_density = time_to_reveal
$WorldEnvironment.environment.sky_custom_fov += delta
$MESH/MeshInstance3D.global_position.x = basic_global_position_1.x + 0.02 * sin(time_to_reveal)
$MESH/MeshInstance3D.global_position.y = basic_global_position_1.y + 0.02 * cos(time_to_reveal)
$MESH/MeshInstance3D2.global_position.x = basic_global_position_2.x + 0.02 * cos(time_to_reveal)
$MESH/MeshInstance3D2.global_position.y = basic_global_position_2.y + 0.02 * sin(time_to_reveal)
if(Input.is_action_just_pressed("start")):
if !is_closing and !$AudioStreamPlayer2.is_playing():
$AudioStreamPlayer2.play()
is_closing = true
if is_closing:
time_to_close -= delta
$WorldEnvironment.environment.volumetric_fog_density = 1.0 - pow(time_to_close, 2.0)
if time_to_close < 0:
get_tree().change_scene_to_file("res://levels/level_1.tscn")