Refactoring UI and Tile logic (to allow for Hotseat/LAN/Online multiplayer)
This commit is contained in:
parent
1ed0ec226d
commit
d688eaf9c6
17 changed files with 591 additions and 17 deletions
31
TestRot.gd
Normal file
31
TestRot.gd
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
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
|
||||
Loading…
Add table
Add a link
Reference in a new issue