hanafuda/Main.gd
2022-01-23 23:56:54 +01:00

41 lines
1.1 KiB
GDScript

extends Node
onready var HanafudaCard = preload("res://HanafudaCard.tscn")
onready var deck = $Deck
onready var tween = $Tween
func _ready():
var dealer = oya()
func oya():
tween.start()
var deck_position = Vector2(10, 10)
var card_reveal_duration = 0.5
var card_dim = 150
var card_1 = HanafudaCard.instance().init_card($Deck.draw_card())
card_1.set_min_dimension(card_dim)
add_child(card_1)
var card_size = card_1.get_size()
var padding = 20
var delta_x = (card_size.x + padding) / 2
tween.interpolate_property(card_1, "position",
deck_position, Vector2(get_viewport().size.x / 2 - delta_x, get_viewport().size.y / 2),
card_reveal_duration,
Tween.TRANS_LINEAR, Tween.EASE_IN_OUT)
var card_2 = HanafudaCard.instance().init_card($Deck.draw_card())
card_2.set_min_dimension(card_dim)
add_child(card_2)
tween.interpolate_property(card_2, "position",
deck_position, Vector2(get_viewport().size.x / 2 + delta_x, get_viewport().size.y / 2),
card_reveal_duration,
Tween.TRANS_LINEAR, Tween.EASE_IN_OUT)
yield(tween, "tween_all_completed")
print("update oya")