61 lines
1.5 KiB
GDScript
61 lines
1.5 KiB
GDScript
extends Control
|
|
|
|
var opened : bool = false
|
|
var menu_choice : int = 0
|
|
var shot_tween : Tween
|
|
var glow_tween : Tween
|
|
@onready var menu_list : Array = [
|
|
%STORY,
|
|
%"VS-COM",
|
|
%"VS-MAN",
|
|
%RECORD,
|
|
%OPTION
|
|
]
|
|
|
|
|
|
var vs_com_scene = preload("res://scenes/character_select.tscn")
|
|
func _ready() -> void:
|
|
shot_tween = create_tween()
|
|
%Target.scale = Vector2(2,2)
|
|
%Target.modulate.a = 0
|
|
shot_tween.set_parallel(true)
|
|
shot_tween.tween_property(%Target, "modulate:a", 1, 1)
|
|
shot_tween.tween_property(%Target, "scale", Vector2(1,1), 1)
|
|
shot_tween.tween_property(%Target, "rotation", PI / 4, 1)
|
|
glow_tween = create_tween()
|
|
glow_tween.set_loops(-1)
|
|
glow_tween.tween_property(%Target, "modulate:a", .8, .5)
|
|
glow_tween.tween_property(%Target, "modulate:a", 1, .5)
|
|
|
|
func _process(delta: float) -> void:
|
|
if Input.is_action_just_pressed("ui_menu"):
|
|
opened = !opened
|
|
%START.visible = !opened
|
|
%Menu.visible = opened
|
|
%SelectSound.play()
|
|
if opened:
|
|
menu_choice = 0
|
|
switch_menu()
|
|
|
|
if opened:
|
|
if Input.is_action_just_pressed("ui_up"):
|
|
menu_choice -= 1
|
|
if menu_choice < 0:
|
|
menu_choice = len(menu_list) - 1
|
|
%SwitchSound.play()
|
|
switch_menu()
|
|
elif Input.is_action_just_pressed("ui_down"):
|
|
menu_choice += 1
|
|
if menu_choice >= len(menu_list):
|
|
menu_choice = 0
|
|
%SwitchSound.play()
|
|
switch_menu()
|
|
elif Input.is_action_just_pressed("ui_accept"):
|
|
Game.switch_scene(vs_com_scene)
|
|
|
|
|
|
func switch_menu() -> void:
|
|
for child in %Menu.get_children():
|
|
child.visible = false
|
|
menu_list[menu_choice].visible = true
|