2018-05-24 04:19:59 -04:00
|
|
|
extends Node
|
|
|
|
|
2018-05-26 02:55:17 -04:00
|
|
|
signal multiplayer_menu
|
|
|
|
|
2018-05-24 04:19:59 -04:00
|
|
|
var clockwise = false
|
|
|
|
var rotation_multiplier = 1
|
|
|
|
const PEAK_ANGLE = -15
|
|
|
|
const TROUGH_ANGLE = -5
|
|
|
|
const SLOW_ROTATION = 0.8
|
|
|
|
const REGULAR_ROTATION = 1
|
2018-05-26 02:55:17 -04:00
|
|
|
var now_quitting = false
|
|
|
|
var rectangle_opacity = 0
|
2018-05-24 04:19:59 -04:00
|
|
|
|
|
|
|
func _ready():
|
|
|
|
$Music.play()
|
|
|
|
|
|
|
|
func _process(delta):
|
2018-05-26 02:55:17 -04:00
|
|
|
if now_quitting == true:
|
2018-05-27 19:22:11 -04:00
|
|
|
$StartEndlessMode.visible = false
|
2018-05-26 02:55:17 -04:00
|
|
|
$ColorRect.color = Color(0, 0, 0, rectangle_opacity)
|
|
|
|
# if rectangle_opacity < 0.75:
|
|
|
|
rectangle_opacity += delta/2
|
|
|
|
$Music.volume_db -= delta*20
|
2018-05-24 04:19:59 -04:00
|
|
|
# else:
|
2018-05-26 02:55:17 -04:00
|
|
|
# rectangle_opacity += delta/4
|
|
|
|
if rectangle_opacity >= 1:
|
|
|
|
get_tree().paused = false
|
|
|
|
queue_free()
|
|
|
|
|
|
|
|
if (Input.is_action_pressed("ui_quit")):
|
|
|
|
get_tree().quit()
|
2018-05-24 04:19:59 -04:00
|
|
|
|
|
|
|
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
|
2018-05-26 02:55:17 -04:00
|
|
|
|
|
|
|
#if Input.is_action_pressed("ui_accept"):
|
|
|
|
# _on_Button_pressed()
|
2018-05-24 04:19:59 -04:00
|
|
|
|
|
|
|
func _on_Button_pressed():
|
2018-05-26 02:55:17 -04:00
|
|
|
#$Button.visible = false
|
|
|
|
now_quitting = true
|
|
|
|
|
|
|
|
func _on_Multiplayer_pressed():
|
|
|
|
emit_signal("multiplayer_menu")
|