Fronter/MainMenu.gd

55 lines
1.2 KiB
GDScript3
Raw Normal View History

extends Node
signal multiplayer_menu
var clockwise = false
var rotation_multiplier = 1
const PEAK_ANGLE = -15
const TROUGH_ANGLE = -5
const SLOW_ROTATION = 0.8
const REGULAR_ROTATION = 1
var now_quitting = false
var rectangle_opacity = 0
func _ready():
$Music.play()
func _process(delta):
if now_quitting == true:
$ColorRect.color = Color(0, 0, 0, rectangle_opacity)
# if rectangle_opacity < 0.75:
rectangle_opacity += delta/2
$Music.volume_db -= delta*20
# else:
# rectangle_opacity += delta/4
if rectangle_opacity >= 1:
get_tree().paused = false
queue_free()
if (Input.is_action_pressed("ui_quit")):
get_tree().quit()
if ($Ship.rotation_degrees > -7 || $Ship.rotation_degrees < -13):
rotation_multiplier = SLOW_ROTATION
else:
rotation_multiplier = REGULAR_ROTATION
if clockwise == true:
$Ship.rotation_degrees += delta
if $Ship.rotation_degrees > TROUGH_ANGLE:
clockwise = false
else:
$Ship.rotation_degrees -= delta
if $Ship.rotation_degrees < PEAK_ANGLE:
clockwise = true
#if Input.is_action_pressed("ui_accept"):
# _on_Button_pressed()
func _on_Button_pressed():
#$Button.visible = false
now_quitting = true
func _on_Multiplayer_pressed():
emit_signal("multiplayer_menu")