Swarm/TestRot.gd

32 lines
1.4 KiB
GDScript3
Raw Normal View History

extends Control
@onready var current_menu: Control = $Level0Main/MainMenu
@onready var level_2 = $Level2
# Called when the node enters the scene tree for the first time.
func _ready():
GameEvents.switch_to_menu.connect(_on_switch_to_menu)
func _on_switch_to_menu(from: Control, to: Control) -> void:
var level: int = to.get_parent().get_meta("level")
var tween = get_tree().create_tween()
tween.set_parallel()
tween.tween_property(from, "modulate", Color(1.0, 1.0, 1.0, 0.0), 0.35).set_trans(Tween.TRANS_EXPO).set_ease(Tween.EASE_IN_OUT)
tween.tween_property(to, "modulate", Color(1.0, 1.0, 1.0, 1.0), 0.35).set_trans(Tween.TRANS_EXPO).set_ease(Tween.EASE_IN_OUT)
tween.tween_property(self, "rotation", - level * deg_to_rad(60.0), 0.75).set_trans(Tween.TRANS_BACK).set_ease(Tween.EASE_OUT)
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
if Input.is_action_just_pressed("place_tile"):
GameEvents.switch_to_menu.emit(current_menu, $Level1/MultiplayerJoin)
if Input.is_action_just_pressed("deselect_tile"):
GameEvents.switch_to_menu.emit($Level1/MultiplayerJoin, current_menu)
#tween.tween_property(self, "rotation", rots[(rots.size()-1) - current_rot_index], 0.5).set_ease(Tween.EASE_IN_OUT).set_trans(Tween.TRANS_EXPO)
#current_rot_index = (rots.size()-1) - current_rot_index
#rotation += 2.0*PI / 6.0
pass