From 852f8cc0ea99f6eddf8cf6aacaf7c286e49ede0d Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Mon, 2 Oct 2023 03:14:45 +0200 Subject: [PATCH] =?UTF-8?q?Add=20silver=E2=86=92gold=20converter?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../copper_converter.gd => converter.gd} | 2 +- .../copper_to_silver}/copper_converter.png | 0 .../copper_converter.png.import | 6 +- .../copper_to_silver/copper_converter.tscn | 4 +- .../silver_to_gold/silver_converter.png | 3 + .../silver_converter.png.import | 34 +++++ .../silver_to_gold/silver_converter.tscn | 121 ++++++++++++++++++ entity/coin_gold/coin_gold.tscn | 39 ++++++ game/game.tscn | 16 ++- main.tscn | 7 +- 10 files changed, 218 insertions(+), 14 deletions(-) rename converters/{copper_to_silver/copper_converter.gd => converter.gd} (95%) rename {entity => converters/copper_to_silver}/copper_converter.png (100%) rename {entity => converters/copper_to_silver}/copper_converter.png.import (68%) create mode 100644 converters/silver_to_gold/silver_converter.png create mode 100644 converters/silver_to_gold/silver_converter.png.import create mode 100644 converters/silver_to_gold/silver_converter.tscn create mode 100644 entity/coin_gold/coin_gold.tscn diff --git a/converters/copper_to_silver/copper_converter.gd b/converters/converter.gd similarity index 95% rename from converters/copper_to_silver/copper_converter.gd rename to converters/converter.gd index c769ed6..486a1a4 100644 --- a/converters/copper_to_silver/copper_converter.gd +++ b/converters/converter.gd @@ -1,5 +1,5 @@ extends StaticBody2D -class_name CopperConverter +class_name Converter var coda : int = 0 diff --git a/entity/copper_converter.png b/converters/copper_to_silver/copper_converter.png similarity index 100% rename from entity/copper_converter.png rename to converters/copper_to_silver/copper_converter.png diff --git a/entity/copper_converter.png.import b/converters/copper_to_silver/copper_converter.png.import similarity index 68% rename from entity/copper_converter.png.import rename to converters/copper_to_silver/copper_converter.png.import index 25015bf..cb02957 100644 --- a/entity/copper_converter.png.import +++ b/converters/copper_to_silver/copper_converter.png.import @@ -3,15 +3,15 @@ importer="texture" type="CompressedTexture2D" uid="uid://pj3ip6vlatms" -path="res://.godot/imported/copper_converter.png-73e2763b5acead72621b333dd31febc6.ctex" +path="res://.godot/imported/copper_converter.png-9ce59e2d408b92173733712a087126e5.ctex" metadata={ "vram_texture": false } [deps] -source_file="res://entity/copper_converter.png" -dest_files=["res://.godot/imported/copper_converter.png-73e2763b5acead72621b333dd31febc6.ctex"] +source_file="res://converters/copper_to_silver/copper_converter.png" +dest_files=["res://.godot/imported/copper_converter.png-9ce59e2d408b92173733712a087126e5.ctex"] [params] diff --git a/converters/copper_to_silver/copper_converter.tscn b/converters/copper_to_silver/copper_converter.tscn index 19bcea2..140553f 100644 --- a/converters/copper_to_silver/copper_converter.tscn +++ b/converters/copper_to_silver/copper_converter.tscn @@ -1,6 +1,6 @@ [gd_scene load_steps=21 format=3 uid="uid://ratkps4plkhl"] -[ext_resource type="Script" path="res://converters/copper_to_silver/copper_converter.gd" id="1_4ba3o"] +[ext_resource type="Script" path="res://converters/converter.gd" id="1_mas6k"] [ext_resource type="PackedScene" uid="uid://dme22vvfgme5f" path="res://entity/coin_silver/coin_silver.tscn" id="2_h5aul"] [ext_resource type="Texture2D" uid="uid://440yhlpwpfw4" path="res://converters/copper_to_silver/copper_converter_back.png" id="3_p24go"] [ext_resource type="Texture2D" uid="uid://dq5aowbt2wxec" path="res://converters/copper_to_silver/copper_converter_front_1.png" id="4_exnn7"] @@ -63,7 +63,7 @@ size = Vector2(26, 10) [node name="CopperConverter" type="StaticBody2D" node_paths=PackedStringArray("sprite_front", "conversion_timer", "sound_working", "sound_complete", "spawner")] scale = Vector2(3, 3) -script = ExtResource("1_4ba3o") +script = ExtResource("1_mas6k") sprite_front = NodePath("SpriteFront") conversion_timer = NodePath("ConversionTimer") sound_working = NodePath("SoundWorking") diff --git a/converters/silver_to_gold/silver_converter.png b/converters/silver_to_gold/silver_converter.png new file mode 100644 index 0000000..189cc75 --- /dev/null +++ b/converters/silver_to_gold/silver_converter.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bcfd34431386a8b4ab11d27cb38d9f63b012a5224fbf67f961bb3b1fd449bc39 +size 5245 diff --git a/converters/silver_to_gold/silver_converter.png.import b/converters/silver_to_gold/silver_converter.png.import new file mode 100644 index 0000000..4598680 --- /dev/null +++ b/converters/silver_to_gold/silver_converter.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://bnctqi24r6ycr" +path="res://.godot/imported/silver_converter.png-e20751e6a89ff68eec66a591a74e4834.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://converters/silver_to_gold/silver_converter.png" +dest_files=["res://.godot/imported/silver_converter.png-e20751e6a89ff68eec66a591a74e4834.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/converters/silver_to_gold/silver_converter.tscn b/converters/silver_to_gold/silver_converter.tscn new file mode 100644 index 0000000..3a33122 --- /dev/null +++ b/converters/silver_to_gold/silver_converter.tscn @@ -0,0 +1,121 @@ +[gd_scene load_steps=17 format=3 uid="uid://but1bdslxp5jl"] + +[ext_resource type="Script" path="res://converters/converter.gd" id="1_chhfg"] +[ext_resource type="Texture2D" uid="uid://c1fu70mb51gyd" path="res://converters/silver_to_gold/silver_converter_back.png" id="2_rpdc3"] +[ext_resource type="Texture2D" uid="uid://d3xa3cqu73xjd" path="res://converters/silver_to_gold/silver_converter_front_1.png" id="3_pscuu"] +[ext_resource type="Texture2D" uid="uid://cwycuwkppcjfu" path="res://converters/silver_to_gold/silver_converter_front_2.png" id="4_yq53c"] +[ext_resource type="Texture2D" uid="uid://b006dig4oebpl" path="res://converters/silver_to_gold/silver_converter_front_3.png" id="5_ycslk"] +[ext_resource type="Texture2D" uid="uid://djixrek5573a6" path="res://converters/silver_to_gold/silver_converter_front_4.png" id="6_0qxp1"] +[ext_resource type="PackedScene" uid="uid://c5w3b55aiui6c" path="res://collector/collector.tscn" id="7_3046q"] +[ext_resource type="PackedScene" uid="uid://c67lfbk4gf1ga" path="res://spawner/spawner.tscn" id="8_65kmt"] +[ext_resource type="PackedScene" uid="uid://du3005kwybbrh" path="res://entity/coin_gold/coin_gold.tscn" id="9_t8y3t"] +[ext_resource type="AudioStream" uid="uid://br25ip30mu174" path="res://audio/conversione/mechanic_sound.wav" id="10_0dr47"] +[ext_resource type="AudioStream" uid="uid://7tw5efuo3gxj" path="res://audio/conversione/coin_to_coin.wav" id="11_ow0vy"] + +[sub_resource type="SpriteFrames" id="SpriteFrames_1qp6y"] +animations = [{ +"frames": [{ +"duration": 1.0, +"texture": ExtResource("3_pscuu") +}, { +"duration": 1.0, +"texture": ExtResource("4_yq53c") +}, { +"duration": 1.0, +"texture": ExtResource("5_ycslk") +}, { +"duration": 1.0, +"texture": ExtResource("6_0qxp1") +}], +"loop": true, +"name": &"default", +"speed": 15.0 +}] + +[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_aslkt"] +radius = 1.5 +height = 28.0 + +[sub_resource type="RectangleShape2D" id="RectangleShape2D_31dtl"] +size = Vector2(26, 4) + +[sub_resource type="RectangleShape2D" id="RectangleShape2D_k11if"] +size = Vector2(26, 5) + +[sub_resource type="RectangleShape2D" id="RectangleShape2D_jeo5f"] +size = Vector2(26, 10) + +[node name="SilverConverter" type="StaticBody2D" node_paths=PackedStringArray("sprite_front", "conversion_timer", "sound_working", "sound_complete", "spawner")] +scale = Vector2(3, 3) +script = ExtResource("1_chhfg") +sprite_front = NodePath("SpriteFront") +conversion_timer = NodePath("ConversionTimer") +sound_working = NodePath("SoundWorking") +sound_complete = NodePath("SoundComplete") +spawner = NodePath("Spawner") + +[node name="SpriteBack" type="Sprite2D" parent="."] +z_index = -2 +texture_filter = 1 +texture = ExtResource("2_rpdc3") + +[node name="SpriteFront" type="AnimatedSprite2D" parent="."] +z_index = 2 +texture_filter = 1 +sprite_frames = SubResource("SpriteFrames_1qp6y") +frame = 3 +frame_progress = 0.193836 + +[node name="LeftWall" type="CollisionShape2D" parent="."] +z_index = 2 +position = Vector2(-14.5, -3) +shape = SubResource("CapsuleShape2D_aslkt") + +[node name="RightWall" type="CollisionShape2D" parent="."] +z_index = 2 +position = Vector2(14.5, -3) +shape = SubResource("CapsuleShape2D_aslkt") + +[node name="InnerWall" type="CollisionShape2D" parent="."] +z_index = 3 +position = Vector2(0, 4.5) +rotation = 3.14159 +shape = SubResource("RectangleShape2D_31dtl") + +[node name="Collector" parent="." instance=ExtResource("7_3046q")] +z_index = 2 +collecting_types = Array[StringName]([&"Silver"]) +collecting_amount = 10 + +[node name="CollectShape" type="CollisionShape2D" parent="Collector"] +shape = SubResource("RectangleShape2D_k11if") +debug_color = Color(0, 0.701961, 0.188235, 0.419608) + +[node name="Spawner" parent="." instance=ExtResource("8_65kmt")] +position = Vector2(0, 8) +scene = ExtResource("9_t8y3t") +buffer_cap = 1 +spawn_rect = Rect2(-8, 0, 16, 4) +spawn_rotation_degrees_min = 80.0 +spawn_rotation_degrees_max = 100.0 +overlapping_body_count_limit = 4 + +[node name="PreventSpawnShape" type="CollisionShape2D" parent="Spawner"] +z_index = 3 +position = Vector2(0, 3.5) +shape = SubResource("RectangleShape2D_jeo5f") +debug_color = Color(0.701961, 0, 0, 0.419608) + +[node name="ConversionTimer" type="Timer" parent="."] +wait_time = 0.5 +one_shot = true + +[node name="SoundWorking" type="AudioStreamPlayer" parent="."] +stream = ExtResource("10_0dr47") + +[node name="SoundComplete" type="AudioStreamPlayer" parent="."] +stream = ExtResource("11_ow0vy") + +[connection signal="collected" from="Collector" to="." method="_on_collector_collected"] +[connection signal="goal" from="Collector" to="." method="_on_collector_goal"] +[connection signal="timeout" from="ConversionTimer" to="." method="_on_timer_timeout"] diff --git a/entity/coin_gold/coin_gold.tscn b/entity/coin_gold/coin_gold.tscn new file mode 100644 index 0000000..10a3c8e --- /dev/null +++ b/entity/coin_gold/coin_gold.tscn @@ -0,0 +1,39 @@ +[gd_scene load_steps=7 format=3 uid="uid://du3005kwybbrh"] + +[ext_resource type="PhysicsMaterial" uid="uid://c6kn1an85lccr" path="res://entity/coin_physics_material.tres" id="1_nfq5t"] +[ext_resource type="Texture2D" uid="uid://dxtstvjlten8p" path="res://entity/coin_gold/coin_gold.png" id="2_1mhvl"] +[ext_resource type="Texture2D" uid="uid://bwqsdmghnrmhy" path="res://entity/coin_gold/coin_gold_outline.png" id="3_v0ty1"] +[ext_resource type="PackedScene" uid="uid://bk1vvq5rug01m" path="res://collector/collectible.tscn" id="4_t2klm"] +[ext_resource type="PackedScene" uid="uid://ujpra0s1kpqi" path="res://value/valuable.tscn" id="5_palpv"] + +[sub_resource type="RectangleShape2D" id="RectangleShape2D_c6byl"] +size = Vector2(27, 5) + +[node name="CoinGold" type="RigidBody2D"] +collision_layer = 5 +collision_mask = 7 +mass = 2.0 +inertia = 600.0 +physics_material_override = ExtResource("1_nfq5t") +continuous_cd = 1 +linear_damp = 0.1 +angular_damp = 0.1 + +[node name="CollisionShape2D" type="CollisionShape2D" parent="."] +scale = Vector2(2, 2) +shape = SubResource("RectangleShape2D_c6byl") + +[node name="Sprite" type="Sprite2D" parent="CollisionShape2D"] +texture_filter = 1 +texture = ExtResource("2_1mhvl") + +[node name="Outline" type="Sprite2D" parent="CollisionShape2D"] +z_index = -1 +texture_filter = 1 +texture = ExtResource("3_v0ty1") + +[node name="Collectible" parent="." instance=ExtResource("4_t2klm")] +type = &"Gold" + +[node name="Valuable" parent="." instance=ExtResource("5_palpv")] +value = 100 diff --git a/game/game.tscn b/game/game.tscn index 0ee22cd..b1730d2 100644 --- a/game/game.tscn +++ b/game/game.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=10 format=3 uid="uid://c3rxmcwa5nqng"] +[gd_scene load_steps=11 format=3 uid="uid://c3rxmcwa5nqng"] [ext_resource type="Script" path="res://game/game.gd" id="1_i3ly0"] [ext_resource type="PackedScene" uid="uid://bllsprv8orpn4" path="res://bottle/bottle.tscn" id="1_y7o2l"] @@ -7,6 +7,7 @@ [ext_resource type="PackedScene" uid="uid://c3kitncwpi42j" path="res://entity/coin_copper/coin_copper.tscn" id="4_5oayc"] [ext_resource type="PackedScene" uid="uid://beg758fa6o0cs" path="res://value/evaluator.tscn" id="6_my6nv"] [ext_resource type="PackedScene" uid="uid://ratkps4plkhl" path="res://converters/copper_to_silver/copper_converter.tscn" id="7_ipeok"] +[ext_resource type="PackedScene" uid="uid://but1bdslxp5jl" path="res://converters/silver_to_gold/silver_converter.tscn" id="8_0bbpi"] [sub_resource type="RectangleShape2D" id="RectangleShape2D_4uksi"] size = Vector2(80, 80) @@ -21,7 +22,7 @@ script = ExtResource("1_i3ly0") [node name="Bottle" parent="." instance=ExtResource("1_y7o2l")] [node name="TimeSpawner" parent="." node_paths=PackedStringArray("target") instance=ExtResource("3_qwsty")] -position = Vector2(136, 40) +position = Vector2(136, 0) scene = ExtResource("4_5oayc") target = NodePath("..") buffer_cap = 1 @@ -29,6 +30,7 @@ spawn_rect = Rect2(-20, 0, 40, 0) overlapping_body_count_limit = 4 [node name="NeckShape" type="CollisionShape2D" parent="TimeSpawner"] +position = Vector2(0, 40) shape = SubResource("RectangleShape2D_4uksi") debug_color = Color(0, 0.6, 0.701961, 0) @@ -59,12 +61,20 @@ shape = SubResource("RectangleShape2D_rh35r") debug_color = Color(0, 0.6, 0.701961, 0) [node name="CopperConverter" parent="." instance=ExtResource("7_ipeok")] -position = Vector2(136, 176) +position = Vector2(63, 337) [node name="Spawner" parent="CopperConverter" index="6" node_paths=PackedStringArray("target")] target = NodePath("../..") +[node name="SilverConverter" parent="." instance=ExtResource("8_0bbpi")] +position = Vector2(136, 417) +rotation = -1.57079 + +[node name="Spawner" parent="SilverConverter" index="6" node_paths=PackedStringArray("target")] +target = NodePath("../..") + [connection signal="timeout" from="TimeSpawner/Timer" to="TimeSpawner" method="spawn"] [connection signal="changed" from="Evaluator" to="." method="_on_score_changed"] [editable path="CopperConverter"] +[editable path="SilverConverter"] diff --git a/main.tscn b/main.tscn index 8058a33..9b5f798 100644 --- a/main.tscn +++ b/main.tscn @@ -28,16 +28,13 @@ script = ExtResource("3_xav0n") [node name="GameWorld" type="CenterContainer" parent="CustomUI"] custom_minimum_size = Vector2(270, 480) layout_mode = 1 -anchors_preset = 7 +anchors_preset = 5 anchor_left = 0.5 -anchor_top = 1.0 anchor_right = 0.5 -anchor_bottom = 1.0 offset_left = -135.0 -offset_top = -480.0 offset_right = 135.0 +offset_bottom = 480.0 grow_horizontal = 2 -grow_vertical = 0 [node name="GameViewport" type="SubViewportContainer" parent="CustomUI/GameWorld"] layout_mode = 2