2018-05-29 00:08:30 -04:00
|
|
|
#
|
|
|
|
# Copyright (C) 2018 Sage Vaillancourt, sagev9000@gmail.com
|
|
|
|
#
|
|
|
|
# This file is part of Fronter.
|
|
|
|
#
|
|
|
|
# Fronter is free software: you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# Fronter is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with Fronter. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
#
|
|
|
|
|
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():
|
2018-05-29 02:52:23 -04:00
|
|
|
$Music.play()
|
2018-05-29 00:08:30 -04:00
|
|
|
pass
|
2018-05-24 04:19:59 -04:00
|
|
|
|
|
|
|
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-29 00:08:30 -04:00
|
|
|
$ColorRect.visible = true
|
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
|
|
|
|
2018-06-03 11:11:27 -04:00
|
|
|
#if (Input.is_action_pressed("ui_accept")):
|
|
|
|
# now_quitting = true
|
|
|
|
|
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")
|