Compare commits

...

1 Commits

Author SHA1 Message Date
Fabien Freling c6ec75e768 display Deck 2021-12-06 23:47:04 +01:00
3 changed files with 16 additions and 3 deletions

13
Deck.gd
View File

@ -1,4 +1,4 @@
extends Node
extends Node2D
var HanafudaCard = preload("res://HanafudaCard.tscn")
@ -64,7 +64,18 @@ onready var cards = [
HanafudaCard.instance().init_card(Enums.Month.DECEMBER, Enums.Type.SCRAP_3),
]
var card_order = []
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
init_card_order()
for c in cards:
add_child(c)
var card: HanafudaCard = cards[0]
card.reveal(true)
func init_card_order() -> void:
card_order.resize(cards.size())
for i in range(cards.size()):
card_order[i] = i

View File

@ -14,9 +14,10 @@ func _ready() -> void:
$Frontside.texture = load(texture_path)
reveal(revealed)
func init_card(month_: int, type_: int) -> void:
func init_card(month_: int, type_: int) -> HanafudaCard:
month = month_
type = type_
return self
func card_texture() -> String:
var m := ""

View File

@ -16,8 +16,9 @@ __meta__ = {
}
[node name="HanafudaCard" parent="." instance=ExtResource( 1 )]
visible = false
position = Vector2( 205, 447 )
month = 2
[node name="Deck" type="Node" parent="."]
[node name="Deck" type="Node2D" parent="."]
script = ExtResource( 3 )