diff --git a/HanafudaCard.gd b/HanafudaCard.gd index 3a32e43..b42d3cd 100644 --- a/HanafudaCard.gd +++ b/HanafudaCard.gd @@ -1,4 +1,5 @@ -extends Sprite +tool +extends Node2D enum Month { JANUARY, @@ -30,11 +31,24 @@ enum Flower { PAULOWNIA, } +export var revealed: bool = true setget reveal + # Called when the node enters the scene tree for the first time. func _ready(): - pass # Replace with function body. - + $Backside/TextureRect.rect_global_position = $"Backside/Border sprite".get_rect() + reveal(revealed) # Called every frame. 'delta' is the elapsed time since the previous frame. -#func _process(delta): -# pass +func _process(delta): + pass + +func reveal(new_reveal: bool): + revealed = new_reveal + if revealed: + print("Reveal card") + $Frontside.show() + $Backside.hide() + else: + print("Conceal card") + $Frontside.hide() + $Backside.show() diff --git a/HanafudaCard.tscn b/HanafudaCard.tscn index 408bdfe..1285ff7 100644 --- a/HanafudaCard.tscn +++ b/HanafudaCard.tscn @@ -1,10 +1,33 @@ -[gd_scene load_steps=3 format=2] +[gd_scene load_steps=5 format=2] [ext_resource path="res://HanafudaCard.gd" type="Script" id=1] [ext_resource path="res://assets/png/Hanafuda_April_Kasu_1.png" type="Texture" id=2] +[ext_resource path="res://assets/png/Hanafuda_border.png" type="Texture" id=3] +[ext_resource path="res://assets/japanese_pattern_01.png" type="Texture" id=4] -[node name="HanafudaCard" type="Sprite"] -position = Vector2( 292.75, 250.01 ) +[node name="HanafudaCard" type="Node2D"] +script = ExtResource( 1 ) +revealed = false + +[node name="Frontside" type="Sprite" parent="."] +visible = false scale = Vector2( 0.2, 0.2 ) texture = ExtResource( 2 ) -script = ExtResource( 1 ) + +[node name="Backside" type="Node2D" parent="."] + +[node name="TextureRect" type="TextureRect" parent="Backside"] +margin_left = -91.0 +margin_top = -155.0 +margin_right = 809.0 +margin_bottom = 1380.0 +rect_scale = Vector2( 0.2, 0.2 ) +texture = ExtResource( 4 ) +stretch_mode = 2 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Border sprite" type="Sprite" parent="Backside"] +scale = Vector2( 0.2, 0.2 ) +texture = ExtResource( 3 ) diff --git a/Main.tscn b/Main.tscn index e91d961..17ca5e7 100644 --- a/Main.tscn +++ b/Main.tscn @@ -2,6 +2,15 @@ [ext_resource path="res://HanafudaCard.tscn" type="PackedScene" id=1] -[node name="Node2D" type="Node2D"] +[node name="Node2D" type="Node"] + +[node name="Background" type="ColorRect" parent="."] +anchor_right = 1.0 +anchor_bottom = 1.0 +color = Color( 0.0941176, 0.423529, 0.27451, 1 ) +__meta__ = { +"_edit_use_anchors_": false +} [node name="HanafudaCard" parent="." instance=ExtResource( 1 )] +position = Vector2( 205, 447 ) diff --git a/assets/LICENSE.md b/assets/LICENSE.md index d2322ff..85beb1b 100644 --- a/assets/LICENSE.md +++ b/assets/LICENSE.md @@ -4,4 +4,7 @@ Hanafuda cards by [Louie Mantia](http://louie.world/). [CC BY-SA 4.0][1] +## Japanese texture +Pattern vector created by callmetak - www.freepik.com + [1]: https://creativecommons.org/licenses/by-sa/4.0/deed.en diff --git a/assets/japanese_pattern_01.png b/assets/japanese_pattern_01.png new file mode 100644 index 0000000..45e5496 Binary files /dev/null and b/assets/japanese_pattern_01.png differ diff --git a/assets/japanese_pattern_01.png.import b/assets/japanese_pattern_01.png.import new file mode 100644 index 0000000..79ca71c --- /dev/null +++ b/assets/japanese_pattern_01.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/japanese_pattern_01.png-f5786b9777fdcad19c4be71085ddc93d.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/japanese_pattern_01.png" +dest_files=[ "res://.import/japanese_pattern_01.png-f5786b9777fdcad19c4be71085ddc93d.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=true +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +process/normal_map_invert_y=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/assets/svg/Hanafuda_border.svg b/assets/svg/Hanafuda_border.svg new file mode 100644 index 0000000..1a0b6a7 --- /dev/null +++ b/assets/svg/Hanafuda_border.svg @@ -0,0 +1,55 @@ + + + + + + + + + + + + + + diff --git a/project.godot b/project.godot index af4c7b3..78467f5 100644 --- a/project.godot +++ b/project.godot @@ -14,6 +14,11 @@ config/name="Hanafuda" run/main_scene="res://Main.tscn" config/icon="res://icon.png" +[display] + +window/size/width=600 +window/size/height=900 + [physics] common/enable_pause_aware_picking=true