42 lines
1.0 KiB
GDScript3
42 lines
1.0 KiB
GDScript3
|
extends Node
|
||
|
|
||
|
var clockwise = false
|
||
|
var rotation_multiplier = 1
|
||
|
const PEAK_ANGLE = -15
|
||
|
const TROUGH_ANGLE = -5
|
||
|
const SLOW_ROTATION = 0.8
|
||
|
const REGULAR_ROTATION = 1
|
||
|
|
||
|
func _ready():
|
||
|
$Music.play()
|
||
|
pass
|
||
|
|
||
|
func _process(delta):
|
||
|
# if clockwise == true:
|
||
|
# $Ship.rotation_degrees += (($Ship.rotation_degrees - TROUGH_ANGLE)*delta*0.2) + (delta/10)
|
||
|
# if $Ship.rotation_degrees < TROUGH_ANGLE:
|
||
|
# clockwise = false
|
||
|
# else:
|
||
|
# $Ship.rotation_degrees -= (($Ship.rotation_degrees - PEAK_ANGLE)*delta*0.2) + (delta/10)
|
||
|
# if $Ship.rotation_degrees > PEAK_ANGLE:
|
||
|
# clockwise = true
|
||
|
|
||
|
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
|
||
|
|
||
|
func _on_Button_pressed():
|
||
|
get_tree().paused = false
|
||
|
queue_free()
|
||
|
pass # replace with function body
|