-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLevelSelection.gd
45 lines (37 loc) · 1.57 KB
/
LevelSelection.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 MarginContainer
var isdir = 1
var direction = 0
@onready var LEVELS = $VBoxContainer/HBoxContainer/Control/HBoxContainer
var initpos
# Called when the node enters the scene tree for the first time.
func _ready():
initpos = LEVELS.global_position + Vector2(70, 100)
Input.set_mouse_mode(Input.MOUSE_MODE_HIDDEN)
isdir = 0
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
if (GlobalVariables.CurrentSelectedLevel < 0):
$VBoxContainer/TITLE.text = "【SELECT LEVEL】"
else:
var name = "LEVEL " + str(GlobalVariables.CurrentSelectedLevel)
var diff = "INDETERMINATE"
if (GlobalVariables.CurrentSelectedLevel < len(GlobalVariables.LEVEL_NAMES)):
name = GlobalVariables.LEVEL_NAMES[GlobalVariables.CurrentSelectedLevel]
diff = GlobalVariables.DIFFICULTIES[GlobalVariables.CurrentSelectedLevel]
$VBoxContainer/TITLE.text = "【" + name + " - " + diff + "】"
func _physics_process(delta):
direction = Input.get_axis("ui_left", "ui_right")
if (direction == 1 && isdir == 0):
isdir = 1
print("NEXT PAGE")
GlobalVariables.MENU_SCREEN = (GlobalVariables.MENU_SCREEN + 1) % GlobalVariables.NUM_MENUS
print(GlobalVariables.MENU_SCREEN)
elif (direction == -1 && isdir == 0):
isdir = 1
print("PREV PAGE")
GlobalVariables.MENU_SCREEN = (GlobalVariables.MENU_SCREEN + GlobalVariables.NUM_MENUS - 1) % GlobalVariables.NUM_MENUS
print(GlobalVariables.MENU_SCREEN)
elif (direction == 0):
isdir = 0
LEVELS.global_position = initpos - Vector2(504 * GlobalVariables.MENU_SCREEN, 0)