hanafuda/Main.gd
2021-12-13 23:38:36 +01:00

55 lines
1.1 KiB
GDScript

extends Node
signal state_completed
var state_stack = []
onready var deck = $Deck
onready var tween = $Tween
func _ready():
state_stack.push_back(funcref(self, "update_game"))
state_stack.push_back(funcref(self, "update_oya"))
func _process(delta):
# print("Main::_process()")
if state_stack.empty():
return
var state = state_stack.pop_back()
# print(state)
if state == null:
return
state.call_func()
yield(self, "state_completed")
# state_stack.pop_back()
func update_oya():
var card_1 = $Deck.card($Deck.draw_card())
card_1.show()
tween.start()
tween.interpolate_property(card_1, "position",
Vector2(0, 0), Vector2(100, 100), 3,
Tween.TRANS_LINEAR, Tween.EASE_IN_OUT)
yield(tween, "tween_all_completed")
yield(tween, "tween_completed")
# var card_2 = $Deck.card($Deck.draw_card())
# card_2.show()
# tween.interpolate_property(card_2, "position",
# Vector2(0, 0), Vector2(-100, 100), 0.4,
# Tween.TRANS_LINEAR, Tween.EASE_IN_OUT)
#
# yield(tween, "tween_all_completed")
print("update oya")
emit_signal("state_completed")
func update_game():
print("update game")
emit_signal("state_completed")