diff --git a/levels/base_level/base_level.gd b/levels/base_level/base_level.gd index 9588c51..a363fc6 100644 --- a/levels/base_level/base_level.gd +++ b/levels/base_level/base_level.gd @@ -87,6 +87,8 @@ func init(_chap_id: int, _lvl_id: int) -> void: table_cloth.size.x = sep * len(question) + 16 table_cloth.size.y = 48 + table_cloth.get_child(0).size.x = sep * len(question) + 16 + table_cloth.get_child(0).size.y = 48 table_cloth.position.x = WIDTH / 2 - sep * len(question) / 2 - 12 table_cloth.position.y = HEIGHT / 2 - 24 $HUDs.add_child(table_cloth) @@ -139,6 +141,13 @@ func _process(_delta): pass +func stage_clear() -> void: + $SFXs/LevelClear.play() + for card_base: CardBase in $CardBases.get_children(): + card_base.call("start_fade") + $HUDs/TableCloth/GoldenCloth.set_visible(true) + + func _on_card_put() -> void: for block : Block in $Blocks.get_children(): if not block.occupied: @@ -168,7 +177,7 @@ func _on_card_put() -> void: for block: Block in $Blocks.get_children(): block.call("shake") else: - $SFXs/LevelClear.play() + stage_clear() diff --git a/objects/block/block.gd b/objects/block/block.gd index cf08ae3..a31bb03 100644 --- a/objects/block/block.gd +++ b/objects/block/block.gd @@ -35,6 +35,8 @@ func set_word(e: String) -> void: func set_block_type(value: String) -> void: if value == "GOLDEN": $GoalFrameSprite.set_visible(true) + $GoalFrameSprite.set_texture(load("res://objects/block/goal_frame" + str(int(sqrt(randi_range(1, 16)))) + ".png")) + $PitSprite.set_visible(true) elif value == "PIT": $GoalFrameSprite.set_visible(false) diff --git a/objects/block/block.tscn b/objects/block/block.tscn index 7fb53e0..75f677a 100644 --- a/objects/block/block.tscn +++ b/objects/block/block.tscn @@ -6,7 +6,7 @@ [ext_resource type="Texture2D" uid="uid://cb71r50jw2a3i" path="res://objects/block/goal_frame2.png" id="4_v6rgm"] [sub_resource type="RectangleShape2D" id="RectangleShape2D_3if4e"] -size = Vector2(24, 24) +size = Vector2(16, 16) [node name="Block" type="Area2D"] script = ExtResource("1_11h57") @@ -14,8 +14,9 @@ script = ExtResource("1_11h57") [node name="Word" parent="." instance=ExtResource("2_pjs40")] [node name="CollisionShape2D" type="CollisionShape2D" parent="."] -z_index = 2 +z_index = 50 shape = SubResource("RectangleShape2D_3if4e") +debug_color = Color(0.968627, 0, 0.470588, 0.419608) [node name="PitSprite" type="Sprite2D" parent="."] z_index = -1 diff --git a/objects/card/card.tscn b/objects/card/card.tscn index 2e5e758..664f49a 100644 --- a/objects/card/card.tscn +++ b/objects/card/card.tscn @@ -1,13 +1,13 @@ -[gd_scene load_steps=8 format=3 uid="uid://b223s12rqgt4h"] +[gd_scene load_steps=9 format=3 uid="uid://b223s12rqgt4h"] [ext_resource type="Script" path="res://objects/card/card.gd" id="1_0bviv"] [ext_resource type="PackedScene" uid="uid://cvx7wowcbfo0r" path="res://objects/word/word.tscn" id="1_ns36n"] [ext_resource type="Texture2D" uid="uid://cfbqh1k0etr6g" path="res://objects/card/card1.png" id="3_o4f0v"] [ext_resource type="Texture2D" uid="uid://c8qjbksyn1bqt" path="res://objects/card/card2.png" id="4_c30j1"] [ext_resource type="Texture2D" uid="uid://bevrfq1hhyqwe" path="res://objects/card/card3.png" id="5_w81n3"] +[ext_resource type="Texture2D" uid="uid://cmcc5xrpkrd0f" path="res://objects/card/card_highlighted.png" id="6_po2i6"] [sub_resource type="RectangleShape2D" id="RectangleShape2D_gu6l6"] -size = Vector2(14, 14) [sub_resource type="SpriteFrames" id="SpriteFrames_fo0r0"] animations = [{ @@ -24,6 +24,14 @@ animations = [{ "loop": true, "name": &"default", "speed": 5.0 +}, { +"frames": [{ +"duration": 1.0, +"texture": ExtResource("6_po2i6") +}], +"loop": true, +"name": &"highlighted", +"speed": 5.0 }] [node name="Card" type="Area2D"] @@ -40,5 +48,5 @@ shape = SubResource("RectangleShape2D_gu6l6") [node name="CardBackSprite" type="AnimatedSprite2D" parent="."] sprite_frames = SubResource("SpriteFrames_fo0r0") +animation = &"highlighted" autoplay = "default" -frame_progress = 0.275098 diff --git a/objects/card_base/card_base.gd b/objects/card_base/card_base.gd index ed3b257..cfd3e65 100644 --- a/objects/card_base/card_base.gd +++ b/objects/card_base/card_base.gd @@ -3,9 +3,14 @@ extends Area2D class_name CardBase const Card := preload("res://objects/card/card.tscn") +const FADE_MOVE_AMOUNT := 70 signal card_put + +var fade_flag := false + + var card_count = 0 var new_card_node: Card @@ -30,7 +35,7 @@ func set_card_count(value): func draw_card(): if card_count <= 0: return - set_card_count(card_count - 1) + set_card_count(card_count - 1) $SFXPickUp.play() new_card_node = Card.instantiate() new_card_node.set_word($Word.get_word()) @@ -70,3 +75,19 @@ func set_word(e: String) -> void: func _on_card_put(): emit_signal("card_put") + + + + +func start_fade() -> void: + fade_flag = true + $FadeTimer.start() + $CollisionShape2D.set_deferred("disabled", true) + $Label.set_visible(false) + +func _process(delta) -> void: + if fade_flag: + var offset = $FadeTimer.time_left / $FadeTimer.wait_time + offset = (1 - pow(offset, 1.5)) * FADE_MOVE_AMOUNT + $AnimatedSprite2D.position.y = offset + $Word.position.y = offset diff --git a/objects/card_base/card_base.tscn b/objects/card_base/card_base.tscn index 16c731a..3189131 100644 --- a/objects/card_base/card_base.tscn +++ b/objects/card_base/card_base.tscn @@ -67,5 +67,9 @@ sprite_frames = SubResource("SpriteFrames_bhb3x") stream = ExtResource("7_0c7kt") volume_db = 8.54 +[node name="FadeTimer" type="Timer" parent="."] +wait_time = 0.2 +one_shot = true + [connection signal="area_entered" from="." to="." method="_on_area_entered"] [connection signal="area_exited" from="." to="." method="_on_area_exited"] diff --git a/objects/table_cloth/golden_cloth.png b/objects/table_cloth/golden_cloth.png new file mode 100644 index 0000000..46bfc19 Binary files /dev/null and b/objects/table_cloth/golden_cloth.png differ diff --git a/objects/table_cloth/golden_cloth.png.import b/objects/table_cloth/golden_cloth.png.import new file mode 100644 index 0000000..d1847c2 --- /dev/null +++ b/objects/table_cloth/golden_cloth.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://cb5gytqlvjj2v" +path="res://.godot/imported/golden_cloth.png-d3073ab0f7dc2414ed963703c673bad9.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://objects/table_cloth/golden_cloth.png" +dest_files=["res://.godot/imported/golden_cloth.png-d3073ab0f7dc2414ed963703c673bad9.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/objects/table_cloth/table_cloth.tscn b/objects/table_cloth/table_cloth.tscn index ccfe6ae..7c0f2ee 100644 --- a/objects/table_cloth/table_cloth.tscn +++ b/objects/table_cloth/table_cloth.tscn @@ -1,6 +1,7 @@ -[gd_scene load_steps=3 format=3 uid="uid://7kd53bu4qorc"] +[gd_scene load_steps=5 format=3 uid="uid://7kd53bu4qorc"] [ext_resource type="Texture2D" uid="uid://1gcwvbyjejey" path="res://objects/table_cloth/table_cloth.png" id="1_8qui1"] +[ext_resource type="Texture2D" uid="uid://cb5gytqlvjj2v" path="res://objects/table_cloth/golden_cloth.png" id="2_3edv5"] [sub_resource type="StyleBoxTexture" id="StyleBoxTexture_js8qc"] texture = ExtResource("1_8qui1") @@ -9,9 +10,24 @@ texture_margin_top = 16.0 texture_margin_right = 16.0 texture_margin_bottom = 16.0 +[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_7iyxp"] +texture = ExtResource("2_3edv5") +texture_margin_left = 16.0 +texture_margin_top = 16.0 +texture_margin_right = 16.0 +texture_margin_bottom = 16.0 + [node name="TableCloth" type="Panel"] z_index = -10 offset_right = 109.0 offset_bottom = 40.0 mouse_filter = 2 theme_override_styles/panel = SubResource("StyleBoxTexture_js8qc") + +[node name="GoldenCloth" type="Panel" parent="."] +visible = false +layout_mode = 0 +offset_right = 109.0 +offset_bottom = 40.0 +mouse_filter = 2 +theme_override_styles/panel = SubResource("StyleBoxTexture_7iyxp")