From c5176574e887b4cd379dc1de681490e4219efa0c Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Mon, 2 Oct 2023 02:53:12 +0200 Subject: [PATCH] The Big Cleanup (tm) --- bottle/bottle.tscn | 1 + collector/collector.gd | 21 ++- .../copper_to_silver/copper_converter.gd | 29 ++++ .../copper_to_silver/copper_converter.tscn | 136 ++++++++++++++++++ .../copper_converter_back.png | 0 .../copper_converter_back.png.import | 6 +- .../copper_converter_front_1.png | 0 .../copper_converter_front_1.png.import | 6 +- .../copper_converter_front_2.png | 0 .../copper_converter_front_2.png.import | 6 +- .../copper_converter_front_3.png | 0 .../copper_converter_front_3.png.import | 6 +- .../copper_converter_front_4.png | 0 .../copper_converter_front_4.png.import | 6 +- .../silver_to_gold}/silver_converter_back.png | 0 .../silver_converter_back.png.import | 6 +- .../silver_converter_front_1.png | 0 .../silver_converter_front_1.png.import | 6 +- .../silver_converter_front_2.png | 0 .../silver_converter_front_2.png.import | 6 +- .../silver_converter_front_3.png | 0 .../silver_converter_front_3.png.import | 6 +- .../silver_converter_front_4.png | 0 .../silver_converter_front_4.png.import | 6 +- convertitore.tscn | 26 ---- convertors/converter_working.gd | 11 -- convertors/copper_to_silver.gd | 26 ---- convertors/copper_to_silver.tscn | 113 --------------- entity/{ => coin_gold}/coin_gold.png | 0 entity/{ => coin_gold}/coin_gold.png.import | 6 +- entity/{ => coin_gold}/coin_gold_outline.png | 0 .../coin_gold_outline.png.import | 6 +- entity/{ => coin_silver}/coin_silver.tscn | 7 +- entity/{ => coin_silver}/coin_silver_1.png | 0 .../coin_silver_1.png.import | 6 +- entity/{ => coin_silver}/coin_silver_2.png | 0 .../coin_silver_2.png.import | 6 +- .../coin_silver_outline_1.png | 0 .../coin_silver_outline_1.png.import | 6 +- .../coin_silver_outline_2.png | 0 .../coin_silver_outline_2.png.import | 6 +- game/game.tscn | 23 ++- View.gd => interface/custom_ui.gd | 3 +- .../font}/press-start/license.txt | 0 .../font}/press-start/prstart.ttf | Bin .../font}/press-start/prstart.ttf.import | 6 +- .../font}/press-start/prstartk.ttf | Bin .../font}/press-start/prstartk.ttf.import | 6 +- interface/interface_theme.tres | 2 +- {entity => interface}/upgrade_copper.png | 0 .../upgrade_copper.png.import | 6 +- {entity => interface}/upgrade_gold.png | 0 {entity => interface}/upgrade_gold.png.import | 6 +- {entity => interface}/upgrade_silver.png | 0 .../upgrade_silver.png.import | 6 +- main.tscn | 81 ++++++----- project.godot | 2 +- spawner/spawner.gd | 4 +- sprite_layers.md | 19 +++ value/evaluator.gd | 24 ++-- 60 files changed, 346 insertions(+), 308 deletions(-) create mode 100644 converters/copper_to_silver/copper_converter.gd create mode 100644 converters/copper_to_silver/copper_converter.tscn rename {entity => converters/copper_to_silver}/copper_converter_back.png (100%) rename {entity => converters/copper_to_silver}/copper_converter_back.png.import (67%) rename {entity => converters}/copper_to_silver/copper_converter_front_1.png (100%) rename {entity => converters}/copper_to_silver/copper_converter_front_1.png.import (74%) rename {entity => converters}/copper_to_silver/copper_converter_front_2.png (100%) rename {entity => converters}/copper_to_silver/copper_converter_front_2.png.import (74%) rename {entity => converters}/copper_to_silver/copper_converter_front_3.png (100%) rename {entity => converters}/copper_to_silver/copper_converter_front_3.png.import (74%) rename {entity => converters}/copper_to_silver/copper_converter_front_4.png (100%) rename {entity => converters}/copper_to_silver/copper_converter_front_4.png.import (74%) rename {entity => converters/silver_to_gold}/silver_converter_back.png (100%) rename {entity => converters/silver_to_gold}/silver_converter_back.png.import (67%) rename {entity => converters/silver_to_gold}/silver_converter_front_1.png (100%) rename {entity => converters/silver_to_gold}/silver_converter_front_1.png.import (74%) rename {entity => converters/silver_to_gold}/silver_converter_front_2.png (100%) rename {entity => converters/silver_to_gold}/silver_converter_front_2.png.import (74%) rename {entity => converters/silver_to_gold}/silver_converter_front_3.png (100%) rename {entity => converters/silver_to_gold}/silver_converter_front_3.png.import (74%) rename {entity => converters/silver_to_gold}/silver_converter_front_4.png (100%) rename {entity => converters/silver_to_gold}/silver_converter_front_4.png.import (74%) delete mode 100644 convertitore.tscn delete mode 100644 convertors/converter_working.gd delete mode 100644 convertors/copper_to_silver.gd delete mode 100644 convertors/copper_to_silver.tscn rename entity/{ => coin_gold}/coin_gold.png (100%) rename entity/{ => coin_gold}/coin_gold.png.import (71%) rename entity/{ => coin_gold}/coin_gold_outline.png (100%) rename entity/{ => coin_gold}/coin_gold_outline.png.import (69%) rename entity/{ => coin_silver}/coin_silver.tscn (89%) rename entity/{ => coin_silver}/coin_silver_1.png (100%) rename entity/{ => coin_silver}/coin_silver_1.png.import (70%) rename entity/{ => coin_silver}/coin_silver_2.png (100%) rename entity/{ => coin_silver}/coin_silver_2.png.import (70%) rename entity/{ => coin_silver}/coin_silver_outline_1.png (100%) rename entity/{ => coin_silver}/coin_silver_outline_1.png.import (68%) rename entity/{ => coin_silver}/coin_silver_outline_2.png (100%) rename entity/{ => coin_silver}/coin_silver_outline_2.png.import (68%) rename View.gd => interface/custom_ui.gd (92%) rename {font => interface/font}/press-start/license.txt (100%) rename {font => interface/font}/press-start/prstart.ttf (100%) rename {font => interface/font}/press-start/prstart.ttf.import (65%) rename {font => interface/font}/press-start/prstartk.ttf (100%) rename {font => interface/font}/press-start/prstartk.ttf.import (65%) rename {entity => interface}/upgrade_copper.png (100%) rename {entity => interface}/upgrade_copper.png.import (70%) rename {entity => interface}/upgrade_gold.png (100%) rename {entity => interface}/upgrade_gold.png.import (71%) rename {entity => interface}/upgrade_silver.png (100%) rename {entity => interface}/upgrade_silver.png.import (70%) create mode 100644 sprite_layers.md diff --git a/bottle/bottle.tscn b/bottle/bottle.tscn index 507857b..4a862a0 100644 --- a/bottle/bottle.tscn +++ b/bottle/bottle.tscn @@ -114,4 +114,5 @@ sources/1 = SubResource("TileSetAtlasSource_6tyce") tile_set = SubResource("TileSet_tr7be") format = 2 layer_0/name = "Main" +layer_0/z_index = 3 layer_0/tile_data = PackedInt32Array(1900544, 1, 2, 1900545, 65537, 2, 1900546, 65537, 2, 1900547, 65537, 2, 1900548, 65537, 2, 1900549, 65537, 2, 1900550, 65537, 2, 1900551, 65537, 2, 1900552, 65537, 2, 1900553, 65537, 2, 1900554, 65537, 2, 1900555, 65537, 2, 1900556, 65537, 2, 1900557, 65537, 2, 1900558, 65537, 2, 1900559, 65537, 2, 1900560, 131073, 2, 1835024, 131073, 1, 1769488, 131073, 1, 1703952, 131073, 1, 1638416, 131073, 1, 1572880, 131073, 1, 1507344, 131073, 1, 1441808, 131073, 1, 1376272, 131073, 1, 1310736, 131073, 1, 1245200, 131073, 1, 1179664, 131073, 1, 1114128, 131073, 1, 1048592, 131073, 1, 983056, 131073, 1, 917520, 131073, 1, 851984, 131073, 1, 786448, 131073, 1, 720912, 131073, 1, 655376, 131073, 1, 589840, 131073, 1, 524304, 131073, 1, 458768, 131073, 1, 393232, 131073, 1, 327696, 131073, 1, 393216, 1, 1, 458752, 1, 1, 524288, 1, 1, 589824, 1, 1, 655360, 1, 1, 720896, 1, 1, 786432, 1, 1, 851968, 1, 1, 917504, 1, 1, 983040, 1, 1, 1048576, 1, 1, 1114112, 1, 1, 1179648, 1, 1, 1245184, 1, 1, 1310720, 1, 1, 1376256, 1, 1, 1441792, 1, 1, 1507328, 1, 1, 1572864, 1, 1, 1638400, 1, 1, 1703936, 1, 1, 1769472, 1, 1, 1835008, 1, 1, 262144, 1, 0, 327680, 1, 1, 262145, 65537, 0, 262146, 65537, 0, 262147, 65537, 0, 262148, 65537, 0, 262160, 131073, 0, 262159, 65537, 0, 262158, 65537, 0, 262157, 65537, 0, 262156, 65537, 0, 262149, 327681, 2, 196613, 327681, 1, 131077, 327681, 1, 65541, 327681, 1, 5, 327681, 0, 4, 196609, 4, 262155, 196609, 2, 196619, 196609, 1, 131083, 196609, 1, 65547, 196609, 1, 11, 196609, 0, 12, 262145, 4) diff --git a/collector/collector.gd b/collector/collector.gd index d05e58b..3ccd1dd 100644 --- a/collector/collector.gd +++ b/collector/collector.gd @@ -11,9 +11,6 @@ var collected_count: int = 0 ## The strings will match only if exactly the same. @export var collecting_types: Array[StringName] -## The collision mask to check colliding body against. -@export_flags_2d_physics var collecting_collision_mask: int - ## The goal amount of entities to collect. ## ## When [collected_count] reaches it, it will be reset to zero, and the "goal" signal will be emitted. @@ -27,14 +24,12 @@ signal goal func _on_body_entered(body: Node2D): - if body is PhysicsBody2D: - if body.collision_layer & collecting_collision_mask: - var collectible: Collectible = body.get_node("Collectible") - if collectible.type in collecting_types: - collected_count += 1 - collectible.collect() - emit_signal("collected", body) - if collected_count >= collecting_amount: - emit_signal("goal") - collected_count = 0 + var collectible: Collectible = body.find_child("Collectible") + if collectible and collectible.type in collecting_types: + collected_count += 1 + collectible.collect() + emit_signal("collected", body) + if collected_count >= collecting_amount: + emit_signal("goal") + collected_count = 0 diff --git a/converters/copper_to_silver/copper_converter.gd b/converters/copper_to_silver/copper_converter.gd new file mode 100644 index 0000000..c769ed6 --- /dev/null +++ b/converters/copper_to_silver/copper_converter.gd @@ -0,0 +1,29 @@ +extends StaticBody2D +class_name CopperConverter + +var coda : int = 0 + +@export var sprite_front: AnimatedSprite2D +@export var conversion_timer: Timer +@export var sound_working: AudioStreamPlayer +@export var sound_complete: AudioStreamPlayer +@export var spawner: Spawner + +func _on_collector_collected(body): + body.queue_free() + +func _on_collector_goal(): + coda+=1 + +func _process(_delta): + if coda>=1 and conversion_timer.is_stopped(): + sprite_front.play() + conversion_timer.start() + sound_working.play() + +func _on_timer_timeout(): + coda-=1 + sprite_front.stop() + sound_working.stop() + sound_complete.play() + spawner.spawn() diff --git a/converters/copper_to_silver/copper_converter.tscn b/converters/copper_to_silver/copper_converter.tscn new file mode 100644 index 0000000..f1c9265 --- /dev/null +++ b/converters/copper_to_silver/copper_converter.tscn @@ -0,0 +1,136 @@ +[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="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"] +[ext_resource type="Texture2D" uid="uid://ck254fewe4l41" path="res://converters/copper_to_silver/copper_converter_front_2.png" id="5_3v5ox"] +[ext_resource type="Texture2D" uid="uid://dg4qq1pgojk8d" path="res://converters/copper_to_silver/copper_converter_front_3.png" id="6_acinx"] +[ext_resource type="Texture2D" uid="uid://60502lbpup6" path="res://converters/copper_to_silver/copper_converter_front_4.png" id="7_11jge"] +[ext_resource type="PackedScene" uid="uid://c5w3b55aiui6c" path="res://collector/collector.tscn" id="8_tc2oo"] +[ext_resource type="PackedScene" uid="uid://c67lfbk4gf1ga" path="res://spawner/spawner.tscn" id="9_2wvgu"] +[ext_resource type="AudioStream" uid="uid://br25ip30mu174" path="res://audio/conversione/mechanic_sound.wav" id="10_6hhch"] +[ext_resource type="AudioStream" uid="uid://7tw5efuo3gxj" path="res://audio/conversione/coin_to_coin.wav" id="11_r8505"] + +[sub_resource type="AtlasTexture" id="AtlasTexture_62dyi"] +atlas = ExtResource("4_exnn7") +region = Rect2(0, 2, 32, 33) + +[sub_resource type="AtlasTexture" id="AtlasTexture_gs3wo"] +atlas = ExtResource("5_3v5ox") +region = Rect2(0, 2, 32, 33) + +[sub_resource type="AtlasTexture" id="AtlasTexture_tboq2"] +atlas = ExtResource("6_acinx") +region = Rect2(0, 2, 32, 33) + +[sub_resource type="AtlasTexture" id="AtlasTexture_okgf4"] +atlas = ExtResource("7_11jge") +region = Rect2(0, 2, 32, 33) + +[sub_resource type="SpriteFrames" id="SpriteFrames_4m3dg"] +animations = [{ +"frames": [{ +"duration": 1.0, +"texture": SubResource("AtlasTexture_62dyi") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_gs3wo") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_tboq2") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_okgf4") +}], +"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="CopperConverter" type="StaticBody2D" node_paths=PackedStringArray("sprite_front", "conversion_timer", "sound_working", "sound_complete", "spawner")] +scale = Vector2(3, 3) +script = ExtResource("1_4ba3o") +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("3_p24go") + +[node name="SpriteFront" type="AnimatedSprite2D" parent="."] +z_index = 2 +texture_filter = 1 +sprite_frames = SubResource("SpriteFrames_4m3dg") +frame_progress = 0.889703 + +[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("8_tc2oo")] +z_index = 2 +collecting_types = Array[StringName]([&"Copper"]) +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("9_2wvgu")] +position = Vector2(0, 8) +scene = ExtResource("2_h5aul") +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_6hhch") + +[node name="SoundComplete" type="AudioStreamPlayer" parent="."] +stream = ExtResource("11_r8505") + +[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/copper_converter_back.png b/converters/copper_to_silver/copper_converter_back.png similarity index 100% rename from entity/copper_converter_back.png rename to converters/copper_to_silver/copper_converter_back.png diff --git a/entity/copper_converter_back.png.import b/converters/copper_to_silver/copper_converter_back.png.import similarity index 67% rename from entity/copper_converter_back.png.import rename to converters/copper_to_silver/copper_converter_back.png.import index 728eee2..2dd80c3 100644 --- a/entity/copper_converter_back.png.import +++ b/converters/copper_to_silver/copper_converter_back.png.import @@ -3,15 +3,15 @@ importer="texture" type="CompressedTexture2D" uid="uid://440yhlpwpfw4" -path="res://.godot/imported/copper_converter_back.png-7f272e03445a06426d3bb09096a04b0f.ctex" +path="res://.godot/imported/copper_converter_back.png-1c9a9f95a0f6e19e5bc57786c83bcedf.ctex" metadata={ "vram_texture": false } [deps] -source_file="res://entity/copper_converter_back.png" -dest_files=["res://.godot/imported/copper_converter_back.png-7f272e03445a06426d3bb09096a04b0f.ctex"] +source_file="res://converters/copper_to_silver/copper_converter_back.png" +dest_files=["res://.godot/imported/copper_converter_back.png-1c9a9f95a0f6e19e5bc57786c83bcedf.ctex"] [params] diff --git a/entity/copper_to_silver/copper_converter_front_1.png b/converters/copper_to_silver/copper_converter_front_1.png similarity index 100% rename from entity/copper_to_silver/copper_converter_front_1.png rename to converters/copper_to_silver/copper_converter_front_1.png diff --git a/entity/copper_to_silver/copper_converter_front_1.png.import b/converters/copper_to_silver/copper_converter_front_1.png.import similarity index 74% rename from entity/copper_to_silver/copper_converter_front_1.png.import rename to converters/copper_to_silver/copper_converter_front_1.png.import index 133e808..74b0f2c 100644 --- a/entity/copper_to_silver/copper_converter_front_1.png.import +++ b/converters/copper_to_silver/copper_converter_front_1.png.import @@ -3,15 +3,15 @@ importer="texture" type="CompressedTexture2D" uid="uid://dq5aowbt2wxec" -path="res://.godot/imported/copper_converter_front_1.png-a66e383124c5d7a3b9eb25fbca72295e.ctex" +path="res://.godot/imported/copper_converter_front_1.png-34889ea8966be83e6216889b5a1ad8c5.ctex" metadata={ "vram_texture": false } [deps] -source_file="res://entity/copper_to_silver/copper_converter_front_1.png" -dest_files=["res://.godot/imported/copper_converter_front_1.png-a66e383124c5d7a3b9eb25fbca72295e.ctex"] +source_file="res://converters/copper_to_silver/copper_converter_front_1.png" +dest_files=["res://.godot/imported/copper_converter_front_1.png-34889ea8966be83e6216889b5a1ad8c5.ctex"] [params] diff --git a/entity/copper_to_silver/copper_converter_front_2.png b/converters/copper_to_silver/copper_converter_front_2.png similarity index 100% rename from entity/copper_to_silver/copper_converter_front_2.png rename to converters/copper_to_silver/copper_converter_front_2.png diff --git a/entity/copper_to_silver/copper_converter_front_2.png.import b/converters/copper_to_silver/copper_converter_front_2.png.import similarity index 74% rename from entity/copper_to_silver/copper_converter_front_2.png.import rename to converters/copper_to_silver/copper_converter_front_2.png.import index b86e765..e25d121 100644 --- a/entity/copper_to_silver/copper_converter_front_2.png.import +++ b/converters/copper_to_silver/copper_converter_front_2.png.import @@ -3,15 +3,15 @@ importer="texture" type="CompressedTexture2D" uid="uid://ck254fewe4l41" -path="res://.godot/imported/copper_converter_front_2.png-1979402e2a27fcfa511130668aff26e5.ctex" +path="res://.godot/imported/copper_converter_front_2.png-54ff83c15563e0a52765e1e8f1b43a36.ctex" metadata={ "vram_texture": false } [deps] -source_file="res://entity/copper_to_silver/copper_converter_front_2.png" -dest_files=["res://.godot/imported/copper_converter_front_2.png-1979402e2a27fcfa511130668aff26e5.ctex"] +source_file="res://converters/copper_to_silver/copper_converter_front_2.png" +dest_files=["res://.godot/imported/copper_converter_front_2.png-54ff83c15563e0a52765e1e8f1b43a36.ctex"] [params] diff --git a/entity/copper_to_silver/copper_converter_front_3.png b/converters/copper_to_silver/copper_converter_front_3.png similarity index 100% rename from entity/copper_to_silver/copper_converter_front_3.png rename to converters/copper_to_silver/copper_converter_front_3.png diff --git a/entity/copper_to_silver/copper_converter_front_3.png.import b/converters/copper_to_silver/copper_converter_front_3.png.import similarity index 74% rename from entity/copper_to_silver/copper_converter_front_3.png.import rename to converters/copper_to_silver/copper_converter_front_3.png.import index c64d384..56a7834 100644 --- a/entity/copper_to_silver/copper_converter_front_3.png.import +++ b/converters/copper_to_silver/copper_converter_front_3.png.import @@ -3,15 +3,15 @@ importer="texture" type="CompressedTexture2D" uid="uid://dg4qq1pgojk8d" -path="res://.godot/imported/copper_converter_front_3.png-b5633cd8b2b9353cf9b41b07df79cc44.ctex" +path="res://.godot/imported/copper_converter_front_3.png-1f1a44895440be718c9a0446e8323611.ctex" metadata={ "vram_texture": false } [deps] -source_file="res://entity/copper_to_silver/copper_converter_front_3.png" -dest_files=["res://.godot/imported/copper_converter_front_3.png-b5633cd8b2b9353cf9b41b07df79cc44.ctex"] +source_file="res://converters/copper_to_silver/copper_converter_front_3.png" +dest_files=["res://.godot/imported/copper_converter_front_3.png-1f1a44895440be718c9a0446e8323611.ctex"] [params] diff --git a/entity/copper_to_silver/copper_converter_front_4.png b/converters/copper_to_silver/copper_converter_front_4.png similarity index 100% rename from entity/copper_to_silver/copper_converter_front_4.png rename to converters/copper_to_silver/copper_converter_front_4.png diff --git a/entity/copper_to_silver/copper_converter_front_4.png.import b/converters/copper_to_silver/copper_converter_front_4.png.import similarity index 74% rename from entity/copper_to_silver/copper_converter_front_4.png.import rename to converters/copper_to_silver/copper_converter_front_4.png.import index d4a2fd6..cfa6510 100644 --- a/entity/copper_to_silver/copper_converter_front_4.png.import +++ b/converters/copper_to_silver/copper_converter_front_4.png.import @@ -3,15 +3,15 @@ importer="texture" type="CompressedTexture2D" uid="uid://60502lbpup6" -path="res://.godot/imported/copper_converter_front_4.png-3e5661e50d79ebd32965daca68902adc.ctex" +path="res://.godot/imported/copper_converter_front_4.png-2925a5aae7e0ddb5b753b26d87182e95.ctex" metadata={ "vram_texture": false } [deps] -source_file="res://entity/copper_to_silver/copper_converter_front_4.png" -dest_files=["res://.godot/imported/copper_converter_front_4.png-3e5661e50d79ebd32965daca68902adc.ctex"] +source_file="res://converters/copper_to_silver/copper_converter_front_4.png" +dest_files=["res://.godot/imported/copper_converter_front_4.png-2925a5aae7e0ddb5b753b26d87182e95.ctex"] [params] diff --git a/entity/silver_converter_back.png b/converters/silver_to_gold/silver_converter_back.png similarity index 100% rename from entity/silver_converter_back.png rename to converters/silver_to_gold/silver_converter_back.png diff --git a/entity/silver_converter_back.png.import b/converters/silver_to_gold/silver_converter_back.png.import similarity index 67% rename from entity/silver_converter_back.png.import rename to converters/silver_to_gold/silver_converter_back.png.import index b788500..4d815df 100644 --- a/entity/silver_converter_back.png.import +++ b/converters/silver_to_gold/silver_converter_back.png.import @@ -3,15 +3,15 @@ importer="texture" type="CompressedTexture2D" uid="uid://c1fu70mb51gyd" -path="res://.godot/imported/silver_converter_back.png-04ef08ef1c6ba3a7ef842e74e84ab87a.ctex" +path="res://.godot/imported/silver_converter_back.png-b6e8043592313ca2140b84435a036074.ctex" metadata={ "vram_texture": false } [deps] -source_file="res://entity/silver_converter_back.png" -dest_files=["res://.godot/imported/silver_converter_back.png-04ef08ef1c6ba3a7ef842e74e84ab87a.ctex"] +source_file="res://converters/silver_to_gold/silver_converter_back.png" +dest_files=["res://.godot/imported/silver_converter_back.png-b6e8043592313ca2140b84435a036074.ctex"] [params] diff --git a/entity/silver_converter_front_1.png b/converters/silver_to_gold/silver_converter_front_1.png similarity index 100% rename from entity/silver_converter_front_1.png rename to converters/silver_to_gold/silver_converter_front_1.png diff --git a/entity/silver_converter_front_1.png.import b/converters/silver_to_gold/silver_converter_front_1.png.import similarity index 74% rename from entity/silver_converter_front_1.png.import rename to converters/silver_to_gold/silver_converter_front_1.png.import index a1ffbed..5f9546b 100644 --- a/entity/silver_converter_front_1.png.import +++ b/converters/silver_to_gold/silver_converter_front_1.png.import @@ -3,15 +3,15 @@ importer="texture" type="CompressedTexture2D" uid="uid://d3xa3cqu73xjd" -path="res://.godot/imported/silver_converter_front_1.png-ef096085a3520f98616dff5262520f12.ctex" +path="res://.godot/imported/silver_converter_front_1.png-53bcda6e88d5c64113eccdff7517d0c7.ctex" metadata={ "vram_texture": false } [deps] -source_file="res://entity/silver_converter_front_1.png" -dest_files=["res://.godot/imported/silver_converter_front_1.png-ef096085a3520f98616dff5262520f12.ctex"] +source_file="res://converters/silver_to_gold/silver_converter_front_1.png" +dest_files=["res://.godot/imported/silver_converter_front_1.png-53bcda6e88d5c64113eccdff7517d0c7.ctex"] [params] diff --git a/entity/silver_converter_front_2.png b/converters/silver_to_gold/silver_converter_front_2.png similarity index 100% rename from entity/silver_converter_front_2.png rename to converters/silver_to_gold/silver_converter_front_2.png diff --git a/entity/silver_converter_front_2.png.import b/converters/silver_to_gold/silver_converter_front_2.png.import similarity index 74% rename from entity/silver_converter_front_2.png.import rename to converters/silver_to_gold/silver_converter_front_2.png.import index e5fc6c0..ecc7660 100644 --- a/entity/silver_converter_front_2.png.import +++ b/converters/silver_to_gold/silver_converter_front_2.png.import @@ -3,15 +3,15 @@ importer="texture" type="CompressedTexture2D" uid="uid://cwycuwkppcjfu" -path="res://.godot/imported/silver_converter_front_2.png-04833d844d5196d082aa61a07f77cad8.ctex" +path="res://.godot/imported/silver_converter_front_2.png-fcab17279adba83bae945a48293c0b43.ctex" metadata={ "vram_texture": false } [deps] -source_file="res://entity/silver_converter_front_2.png" -dest_files=["res://.godot/imported/silver_converter_front_2.png-04833d844d5196d082aa61a07f77cad8.ctex"] +source_file="res://converters/silver_to_gold/silver_converter_front_2.png" +dest_files=["res://.godot/imported/silver_converter_front_2.png-fcab17279adba83bae945a48293c0b43.ctex"] [params] diff --git a/entity/silver_converter_front_3.png b/converters/silver_to_gold/silver_converter_front_3.png similarity index 100% rename from entity/silver_converter_front_3.png rename to converters/silver_to_gold/silver_converter_front_3.png diff --git a/entity/silver_converter_front_3.png.import b/converters/silver_to_gold/silver_converter_front_3.png.import similarity index 74% rename from entity/silver_converter_front_3.png.import rename to converters/silver_to_gold/silver_converter_front_3.png.import index ed5fcd6..32e8382 100644 --- a/entity/silver_converter_front_3.png.import +++ b/converters/silver_to_gold/silver_converter_front_3.png.import @@ -3,15 +3,15 @@ importer="texture" type="CompressedTexture2D" uid="uid://b006dig4oebpl" -path="res://.godot/imported/silver_converter_front_3.png-ba3e375be79147732d0a2cccd2e35d9d.ctex" +path="res://.godot/imported/silver_converter_front_3.png-433f3ba0992715c422a31e1b80bab186.ctex" metadata={ "vram_texture": false } [deps] -source_file="res://entity/silver_converter_front_3.png" -dest_files=["res://.godot/imported/silver_converter_front_3.png-ba3e375be79147732d0a2cccd2e35d9d.ctex"] +source_file="res://converters/silver_to_gold/silver_converter_front_3.png" +dest_files=["res://.godot/imported/silver_converter_front_3.png-433f3ba0992715c422a31e1b80bab186.ctex"] [params] diff --git a/entity/silver_converter_front_4.png b/converters/silver_to_gold/silver_converter_front_4.png similarity index 100% rename from entity/silver_converter_front_4.png rename to converters/silver_to_gold/silver_converter_front_4.png diff --git a/entity/silver_converter_front_4.png.import b/converters/silver_to_gold/silver_converter_front_4.png.import similarity index 74% rename from entity/silver_converter_front_4.png.import rename to converters/silver_to_gold/silver_converter_front_4.png.import index 1d7d4f9..e0f54f5 100644 --- a/entity/silver_converter_front_4.png.import +++ b/converters/silver_to_gold/silver_converter_front_4.png.import @@ -3,15 +3,15 @@ importer="texture" type="CompressedTexture2D" uid="uid://djixrek5573a6" -path="res://.godot/imported/silver_converter_front_4.png-a845708798135d9b44d995527379c3e3.ctex" +path="res://.godot/imported/silver_converter_front_4.png-d727ad2235230d9eceeab1a134e5a1cc.ctex" metadata={ "vram_texture": false } [deps] -source_file="res://entity/silver_converter_front_4.png" -dest_files=["res://.godot/imported/silver_converter_front_4.png-a845708798135d9b44d995527379c3e3.ctex"] +source_file="res://converters/silver_to_gold/silver_converter_front_4.png" +dest_files=["res://.godot/imported/silver_converter_front_4.png-d727ad2235230d9eceeab1a134e5a1cc.ctex"] [params] diff --git a/convertitore.tscn b/convertitore.tscn deleted file mode 100644 index a4b80f1..0000000 --- a/convertitore.tscn +++ /dev/null @@ -1,26 +0,0 @@ -[gd_scene load_steps=3 format=3 uid="uid://ei1b0ity3nwg"] - -[ext_resource type="Script" path="res://Convertitore.gd" id="1_7de38"] -[ext_resource type="Texture2D" uid="uid://cxsl5yvdhswc7" path="res://icon.png" id="2_8bfs6"] - -[node name="Convertitore" type="Node2D"] -script = ExtResource("1_7de38") - -[node name="Icon" type="Sprite2D" parent="."] -position = Vector2(61, 76) -rotation = 1.5708 -scale = Vector2(0.2, 0.2) -texture = ExtResource("2_8bfs6") - -[node name="StaticBody2D" type="StaticBody2D" parent="."] - -[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="StaticBody2D"] -polygon = PackedVector2Array(36, 114, 36, 38, 42, 56, 61, 57, 79, 56, 85, 38, 85, 115, 61, 91) - -[node name="Ingresso" type="Area2D" parent="."] -position = Vector2(56, 42) - -[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="Ingresso"] -polygon = PackedVector2Array(-20, -6, 29, -6, 23, 11, 5, 14, -12, 12) - -[connection signal="body_shape_entered" from="Ingresso" to="." method="_on_ingresso_body_shape_entered"] diff --git a/convertors/converter_working.gd b/convertors/converter_working.gd deleted file mode 100644 index bbec3de..0000000 --- a/convertors/converter_working.gd +++ /dev/null @@ -1,11 +0,0 @@ -extends AudioStreamPlayer - - -# Called when the node enters the scene tree for the first time. -func _ready(): - pass # Replace with function body. - - -# Called every frame. 'delta' is the elapsed time since the previous frame. -func _process(delta): - pass diff --git a/convertors/copper_to_silver.gd b/convertors/copper_to_silver.gd deleted file mode 100644 index 7b7cfd5..0000000 --- a/convertors/copper_to_silver.gd +++ /dev/null @@ -1,26 +0,0 @@ -extends StaticBody2D - -var coda : int = 0 - -@export var scene: PackedScene - -@onready var _animated_sprite = $AnimatedSprite2D - -func _on_collector_collected(body): - body.queue_free() - -func _on_collector_goal(): - coda+=1 - -func _process(delta): - if coda>=1 and $Timer.is_stopped(): - $AnimatedSprite2D.play() - $converter_working.play() - $Timer.start() - -func _on_timer_timeout(): - coda-=1 - $AnimatedSprite2D.stop() - $converter_working.stop() - $New_item.play() - $Spawner.spawn() diff --git a/convertors/copper_to_silver.tscn b/convertors/copper_to_silver.tscn deleted file mode 100644 index 8461cce..0000000 --- a/convertors/copper_to_silver.tscn +++ /dev/null @@ -1,113 +0,0 @@ -[gd_scene load_steps=19 format=3 uid="uid://ratkps4plkhl"] - -[ext_resource type="Script" path="res://convertors/copper_to_silver.gd" id="1_jjv83"] -[ext_resource type="PackedScene" uid="uid://dme22vvfgme5f" path="res://entity/coin_silver.tscn" id="2_orv64"] -[ext_resource type="PackedScene" uid="uid://c5w3b55aiui6c" path="res://collector/collector.tscn" id="3_a4naa"] -[ext_resource type="AudioStream" uid="uid://br25ip30mu174" path="res://audio/conversione/mechanic_sound.wav" id="3_uxx6n"] -[ext_resource type="Texture2D" uid="uid://dq5aowbt2wxec" path="res://entity/copper_to_silver/copper_converter_front_1.png" id="4_04v4v"] -[ext_resource type="PackedScene" uid="uid://c67lfbk4gf1ga" path="res://spawner/spawner.tscn" id="5_1n0vw"] -[ext_resource type="Texture2D" uid="uid://ck254fewe4l41" path="res://entity/copper_to_silver/copper_converter_front_2.png" id="5_tbfff"] -[ext_resource type="Texture2D" uid="uid://dg4qq1pgojk8d" path="res://entity/copper_to_silver/copper_converter_front_3.png" id="6_8ghce"] -[ext_resource type="Texture2D" uid="uid://60502lbpup6" path="res://entity/copper_to_silver/copper_converter_front_4.png" id="7_e53sb"] -[ext_resource type="AudioStream" uid="uid://7tw5efuo3gxj" path="res://audio/conversione/coin_to_coin.wav" id="10_uc0v7"] -[ext_resource type="Texture2D" uid="uid://440yhlpwpfw4" path="res://entity/copper_converter_back.png" id="11_c4wel"] - -[sub_resource type="AtlasTexture" id="AtlasTexture_62dyi"] -atlas = ExtResource("4_04v4v") -region = Rect2(0, 2, 32, 33) - -[sub_resource type="AtlasTexture" id="AtlasTexture_gs3wo"] -atlas = ExtResource("5_tbfff") -region = Rect2(0, 2, 32, 33) - -[sub_resource type="AtlasTexture" id="AtlasTexture_tboq2"] -atlas = ExtResource("6_8ghce") -region = Rect2(0, 2, 32, 33) - -[sub_resource type="AtlasTexture" id="AtlasTexture_okgf4"] -atlas = ExtResource("7_e53sb") -region = Rect2(0, 2, 32, 33) - -[sub_resource type="SpriteFrames" id="SpriteFrames_4m3dg"] -animations = [{ -"frames": [{ -"duration": 1.0, -"texture": SubResource("AtlasTexture_62dyi") -}, { -"duration": 1.0, -"texture": SubResource("AtlasTexture_gs3wo") -}, { -"duration": 1.0, -"texture": SubResource("AtlasTexture_tboq2") -}, { -"duration": 1.0, -"texture": SubResource("AtlasTexture_okgf4") -}], -"loop": true, -"name": &"default", -"speed": 5.0 -}] - -[sub_resource type="RectangleShape2D" id="RectangleShape2D_k11if"] -size = Vector2(26, 5) - -[sub_resource type="RectangleShape2D" id="RectangleShape2D_31dtl"] -size = Vector2(25.8333, 5) - -[node name="CopperToSilver" type="StaticBody2D"] -scale = Vector2(3, 3) -script = ExtResource("1_jjv83") -scene = ExtResource("2_orv64") - -[node name="converter_working" type="AudioStreamPlayer" parent="."] -stream = ExtResource("3_uxx6n") - -[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."] -texture_filter = 1 -sprite_frames = SubResource("SpriteFrames_4m3dg") -frame_progress = 0.143561 - -[node name="CopperConverterBack" type="Sprite2D" parent="."] -z_index = -10 -texture_filter = 1 -position = Vector2(0, -1) -texture = ExtResource("11_c4wel") - -[node name="Collector" parent="." instance=ExtResource("3_a4naa")] -collecting_types = Array[StringName]([&"Copper"]) -collecting_collision_mask = 4 -collecting_amount = 1 - -[node name="CollisionShape2D" type="CollisionShape2D" parent="Collector"] -position = Vector2(0, 9.5) -shape = SubResource("RectangleShape2D_k11if") - -[node name="Spawner" parent="." instance=ExtResource("5_1n0vw")] -position = Vector2(-0.333333, 19.3333) -scene = ExtResource("2_orv64") -buffer_cap = 1 -spawn_rotation_range = 90.0 - -[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="."] -polygon = PackedVector2Array(-16, 13.5, -16, -16.5, -14.5, -17.5, -13, -16.5, -13, 13.5) - -[node name="CollisionPolygon2D2" type="CollisionPolygon2D" parent="."] -polygon = PackedVector2Array(13, 12.5, 13, -16.5, 14.5, -17.5, 16, -16.5, 16, 12.5) - -[node name="CollisionShape2D3" type="CollisionShape2D" parent="."] -position = Vector2(0, 12.3333) -rotation = 3.14159 -shape = SubResource("RectangleShape2D_31dtl") -one_way_collision = true -one_way_collision_margin = 8.0 - -[node name="Timer" type="Timer" parent="."] -wait_time = 0.518 -one_shot = true - -[node name="New_item" type="AudioStreamPlayer" parent="."] -stream = ExtResource("10_uc0v7") - -[connection signal="collected" from="Collector" to="." method="_on_collector_collected"] -[connection signal="goal" from="Collector" to="." method="_on_collector_goal"] -[connection signal="timeout" from="Timer" to="." method="_on_timer_timeout"] diff --git a/entity/coin_gold.png b/entity/coin_gold/coin_gold.png similarity index 100% rename from entity/coin_gold.png rename to entity/coin_gold/coin_gold.png diff --git a/entity/coin_gold.png.import b/entity/coin_gold/coin_gold.png.import similarity index 71% rename from entity/coin_gold.png.import rename to entity/coin_gold/coin_gold.png.import index 5e404ce..b9c6d56 100644 --- a/entity/coin_gold.png.import +++ b/entity/coin_gold/coin_gold.png.import @@ -3,15 +3,15 @@ importer="texture" type="CompressedTexture2D" uid="uid://dxtstvjlten8p" -path="res://.godot/imported/coin_gold.png-0c230a4cf47b2f846ae95a49942eff1e.ctex" +path="res://.godot/imported/coin_gold.png-8b4d85f624fcb20822237cdfb358e60c.ctex" metadata={ "vram_texture": false } [deps] -source_file="res://entity/coin_gold.png" -dest_files=["res://.godot/imported/coin_gold.png-0c230a4cf47b2f846ae95a49942eff1e.ctex"] +source_file="res://entity/coin_gold/coin_gold.png" +dest_files=["res://.godot/imported/coin_gold.png-8b4d85f624fcb20822237cdfb358e60c.ctex"] [params] diff --git a/entity/coin_gold_outline.png b/entity/coin_gold/coin_gold_outline.png similarity index 100% rename from entity/coin_gold_outline.png rename to entity/coin_gold/coin_gold_outline.png diff --git a/entity/coin_gold_outline.png.import b/entity/coin_gold/coin_gold_outline.png.import similarity index 69% rename from entity/coin_gold_outline.png.import rename to entity/coin_gold/coin_gold_outline.png.import index 07c9dbb..8642c26 100644 --- a/entity/coin_gold_outline.png.import +++ b/entity/coin_gold/coin_gold_outline.png.import @@ -3,15 +3,15 @@ importer="texture" type="CompressedTexture2D" uid="uid://bwqsdmghnrmhy" -path="res://.godot/imported/coin_gold_outline.png-a9a15b5756ee7fa7d320f210be0aa93e.ctex" +path="res://.godot/imported/coin_gold_outline.png-ff5c1193197804594dce59fb725c7d2a.ctex" metadata={ "vram_texture": false } [deps] -source_file="res://entity/coin_gold_outline.png" -dest_files=["res://.godot/imported/coin_gold_outline.png-a9a15b5756ee7fa7d320f210be0aa93e.ctex"] +source_file="res://entity/coin_gold/coin_gold_outline.png" +dest_files=["res://.godot/imported/coin_gold_outline.png-ff5c1193197804594dce59fb725c7d2a.ctex"] [params] diff --git a/entity/coin_silver.tscn b/entity/coin_silver/coin_silver.tscn similarity index 89% rename from entity/coin_silver.tscn rename to entity/coin_silver/coin_silver.tscn index f5ec7b0..d7fb99f 100644 --- a/entity/coin_silver.tscn +++ b/entity/coin_silver/coin_silver.tscn @@ -1,8 +1,8 @@ [gd_scene load_steps=7 format=3 uid="uid://dme22vvfgme5f"] [ext_resource type="PhysicsMaterial" uid="uid://c6kn1an85lccr" path="res://entity/coin_physics_material.tres" id="1_4sq1a"] -[ext_resource type="Texture2D" uid="uid://m5t74cw8ht5b" path="res://entity/coin_silver_2.png" id="2_0u0up"] -[ext_resource type="Texture2D" uid="uid://beikajpd08pwr" path="res://entity/coin_silver_outline_2.png" id="3_nxu2p"] +[ext_resource type="Texture2D" uid="uid://m5t74cw8ht5b" path="res://entity/coin_silver/coin_silver_2.png" id="2_0u0up"] +[ext_resource type="Texture2D" uid="uid://beikajpd08pwr" path="res://entity/coin_silver/coin_silver_outline_2.png" id="3_nxu2p"] [ext_resource type="PackedScene" uid="uid://bk1vvq5rug01m" path="res://collector/collectible.tscn" id="4_12sii"] [ext_resource type="PackedScene" uid="uid://ujpra0s1kpqi" path="res://value/valuable.tscn" id="5_u3bvw"] @@ -12,13 +12,14 @@ size = Vector2(23, 6.16667) [node name="CoinSilver" type="RigidBody2D"] collision_layer = 5 collision_mask = 7 -inertia = 20000.0 +inertia = 800.0 physics_material_override = ExtResource("1_4sq1a") 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"] diff --git a/entity/coin_silver_1.png b/entity/coin_silver/coin_silver_1.png similarity index 100% rename from entity/coin_silver_1.png rename to entity/coin_silver/coin_silver_1.png diff --git a/entity/coin_silver_1.png.import b/entity/coin_silver/coin_silver_1.png.import similarity index 70% rename from entity/coin_silver_1.png.import rename to entity/coin_silver/coin_silver_1.png.import index 5501cd2..79c5a71 100644 --- a/entity/coin_silver_1.png.import +++ b/entity/coin_silver/coin_silver_1.png.import @@ -3,15 +3,15 @@ importer="texture" type="CompressedTexture2D" uid="uid://ka80ykp18028" -path="res://.godot/imported/coin_silver_1.png-a48162ec5f5f46384aa6663fffc12f8c.ctex" +path="res://.godot/imported/coin_silver_1.png-2670e35ba80d25a262e572ebd0ef72ea.ctex" metadata={ "vram_texture": false } [deps] -source_file="res://entity/coin_silver_1.png" -dest_files=["res://.godot/imported/coin_silver_1.png-a48162ec5f5f46384aa6663fffc12f8c.ctex"] +source_file="res://entity/coin_silver/coin_silver_1.png" +dest_files=["res://.godot/imported/coin_silver_1.png-2670e35ba80d25a262e572ebd0ef72ea.ctex"] [params] diff --git a/entity/coin_silver_2.png b/entity/coin_silver/coin_silver_2.png similarity index 100% rename from entity/coin_silver_2.png rename to entity/coin_silver/coin_silver_2.png diff --git a/entity/coin_silver_2.png.import b/entity/coin_silver/coin_silver_2.png.import similarity index 70% rename from entity/coin_silver_2.png.import rename to entity/coin_silver/coin_silver_2.png.import index 4929241..c2a201d 100644 --- a/entity/coin_silver_2.png.import +++ b/entity/coin_silver/coin_silver_2.png.import @@ -3,15 +3,15 @@ importer="texture" type="CompressedTexture2D" uid="uid://m5t74cw8ht5b" -path="res://.godot/imported/coin_silver_2.png-18851bda07d4e744c78c4ede3f3b42e5.ctex" +path="res://.godot/imported/coin_silver_2.png-0107c299fda6d9a2327b5044c9b91cd1.ctex" metadata={ "vram_texture": false } [deps] -source_file="res://entity/coin_silver_2.png" -dest_files=["res://.godot/imported/coin_silver_2.png-18851bda07d4e744c78c4ede3f3b42e5.ctex"] +source_file="res://entity/coin_silver/coin_silver_2.png" +dest_files=["res://.godot/imported/coin_silver_2.png-0107c299fda6d9a2327b5044c9b91cd1.ctex"] [params] diff --git a/entity/coin_silver_outline_1.png b/entity/coin_silver/coin_silver_outline_1.png similarity index 100% rename from entity/coin_silver_outline_1.png rename to entity/coin_silver/coin_silver_outline_1.png diff --git a/entity/coin_silver_outline_1.png.import b/entity/coin_silver/coin_silver_outline_1.png.import similarity index 68% rename from entity/coin_silver_outline_1.png.import rename to entity/coin_silver/coin_silver_outline_1.png.import index 1243f99..06b5622 100644 --- a/entity/coin_silver_outline_1.png.import +++ b/entity/coin_silver/coin_silver_outline_1.png.import @@ -3,15 +3,15 @@ importer="texture" type="CompressedTexture2D" uid="uid://cs40hfae5owys" -path="res://.godot/imported/coin_silver_outline_1.png-329013be3e0d77aa7f6ece6c5faf95f4.ctex" +path="res://.godot/imported/coin_silver_outline_1.png-449e899c63739926388ac0b901afde8f.ctex" metadata={ "vram_texture": false } [deps] -source_file="res://entity/coin_silver_outline_1.png" -dest_files=["res://.godot/imported/coin_silver_outline_1.png-329013be3e0d77aa7f6ece6c5faf95f4.ctex"] +source_file="res://entity/coin_silver/coin_silver_outline_1.png" +dest_files=["res://.godot/imported/coin_silver_outline_1.png-449e899c63739926388ac0b901afde8f.ctex"] [params] diff --git a/entity/coin_silver_outline_2.png b/entity/coin_silver/coin_silver_outline_2.png similarity index 100% rename from entity/coin_silver_outline_2.png rename to entity/coin_silver/coin_silver_outline_2.png diff --git a/entity/coin_silver_outline_2.png.import b/entity/coin_silver/coin_silver_outline_2.png.import similarity index 68% rename from entity/coin_silver_outline_2.png.import rename to entity/coin_silver/coin_silver_outline_2.png.import index 32ffb9b..4efb131 100644 --- a/entity/coin_silver_outline_2.png.import +++ b/entity/coin_silver/coin_silver_outline_2.png.import @@ -3,15 +3,15 @@ importer="texture" type="CompressedTexture2D" uid="uid://beikajpd08pwr" -path="res://.godot/imported/coin_silver_outline_2.png-57828eb65d233b882bb872244b8fce87.ctex" +path="res://.godot/imported/coin_silver_outline_2.png-1009e70b10b7500d6efd7d083e1d8158.ctex" metadata={ "vram_texture": false } [deps] -source_file="res://entity/coin_silver_outline_2.png" -dest_files=["res://.godot/imported/coin_silver_outline_2.png-57828eb65d233b882bb872244b8fce87.ctex"] +source_file="res://entity/coin_silver/coin_silver_outline_2.png" +dest_files=["res://.godot/imported/coin_silver_outline_2.png-1009e70b10b7500d6efd7d083e1d8158.ctex"] [params] diff --git a/game/game.tscn b/game/game.tscn index 4123670..0ee22cd 100644 --- a/game/game.tscn +++ b/game/game.tscn @@ -1,11 +1,12 @@ -[gd_scene load_steps=9 format=3 uid="uid://c3rxmcwa5nqng"] +[gd_scene load_steps=10 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"] [ext_resource type="PackedScene" uid="uid://d05b8jy3xmpcb" path="res://bottle/gravity_from_gyro.tscn" id="2_h2pfr"] [ext_resource type="PackedScene" uid="uid://c67lfbk4gf1ga" path="res://spawner/spawner.tscn" id="3_qwsty"] -[ext_resource type="PackedScene" uid="uid://c3kitncwpi42j" path="res://entity/coin_copper.tscn" id="4_e5nwi"] +[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"] [sub_resource type="RectangleShape2D" id="RectangleShape2D_4uksi"] size = Vector2(80, 80) @@ -21,7 +22,7 @@ script = ExtResource("1_i3ly0") [node name="TimeSpawner" parent="." node_paths=PackedStringArray("target") instance=ExtResource("3_qwsty")] position = Vector2(136, 40) -scene = ExtResource("4_e5nwi") +scene = ExtResource("4_5oayc") target = NodePath("..") buffer_cap = 1 spawn_rect = Rect2(-20, 0, 40, 0) @@ -29,6 +30,7 @@ overlapping_body_count_limit = 4 [node name="NeckShape" type="CollisionShape2D" parent="TimeSpawner"] shape = SubResource("RectangleShape2D_4uksi") +debug_color = Color(0, 0.6, 0.701961, 0) [node name="Timer" type="Timer" parent="TimeSpawner"] wait_time = 0.1 @@ -36,7 +38,7 @@ autostart = true [node name="ButtonSpawner" parent="." node_paths=PackedStringArray("target") instance=ExtResource("3_qwsty")] position = Vector2(136, 0) -scene = ExtResource("4_e5nwi") +scene = ExtResource("4_5oayc") target = NodePath("..") buffer_cap = 10 spawn_rect = Rect2(-20, 0, 40, 0) @@ -45,15 +47,24 @@ overlapping_body_count_limit = 4 [node name="NeckShape" type="CollisionShape2D" parent="ButtonSpawner"] position = Vector2(0, 40) shape = SubResource("RectangleShape2D_4uksi") +debug_color = Color(0, 0.6, 0.701961, 0) [node name="GravityFromGyro" parent="." instance=ExtResource("2_h2pfr")] [node name="Evaluator" parent="." instance=ExtResource("6_my6nv")] -position = Vector2(128, 256) +position = Vector2(136, 272) [node name="BottleShape" type="CollisionShape2D" parent="Evaluator"] -position = Vector2(8, 16) 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) + +[node name="Spawner" parent="CopperConverter" 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"] diff --git a/View.gd b/interface/custom_ui.gd similarity index 92% rename from View.gd rename to interface/custom_ui.gd index 263bea4..f855da1 100644 --- a/View.gd +++ b/interface/custom_ui.gd @@ -1,5 +1,5 @@ extends Control -class_name View +class_name CustomUI @onready var window: Window = get_window() @@ -8,6 +8,7 @@ class_name View func _ready(): viewport.size_changed.connect(_on_viewport_size_changed) + _on_viewport_size_changed() func _on_viewport_size_changed(): diff --git a/font/press-start/license.txt b/interface/font/press-start/license.txt similarity index 100% rename from font/press-start/license.txt rename to interface/font/press-start/license.txt diff --git a/font/press-start/prstart.ttf b/interface/font/press-start/prstart.ttf similarity index 100% rename from font/press-start/prstart.ttf rename to interface/font/press-start/prstart.ttf diff --git a/font/press-start/prstart.ttf.import b/interface/font/press-start/prstart.ttf.import similarity index 65% rename from font/press-start/prstart.ttf.import rename to interface/font/press-start/prstart.ttf.import index d848dbf..bd6dc57 100644 --- a/font/press-start/prstart.ttf.import +++ b/interface/font/press-start/prstart.ttf.import @@ -3,12 +3,12 @@ importer="font_data_dynamic" type="FontFile" uid="uid://cs8tiwyb76gig" -path="res://.godot/imported/prstart.ttf-77979a39b6795825f06cbbc26a7dc760.fontdata" +path="res://.godot/imported/prstart.ttf-c70a67af7718159cbebe59f27e1bdf23.fontdata" [deps] -source_file="res://font/press-start/prstart.ttf" -dest_files=["res://.godot/imported/prstart.ttf-77979a39b6795825f06cbbc26a7dc760.fontdata"] +source_file="res://interface/font/press-start/prstart.ttf" +dest_files=["res://.godot/imported/prstart.ttf-c70a67af7718159cbebe59f27e1bdf23.fontdata"] [params] diff --git a/font/press-start/prstartk.ttf b/interface/font/press-start/prstartk.ttf similarity index 100% rename from font/press-start/prstartk.ttf rename to interface/font/press-start/prstartk.ttf diff --git a/font/press-start/prstartk.ttf.import b/interface/font/press-start/prstartk.ttf.import similarity index 65% rename from font/press-start/prstartk.ttf.import rename to interface/font/press-start/prstartk.ttf.import index 1f735e6..63d8195 100644 --- a/font/press-start/prstartk.ttf.import +++ b/interface/font/press-start/prstartk.ttf.import @@ -3,12 +3,12 @@ importer="font_data_dynamic" type="FontFile" uid="uid://d347wxfowscit" -path="res://.godot/imported/prstartk.ttf-71558b3660967bfa8cc6acae2bc11f53.fontdata" +path="res://.godot/imported/prstartk.ttf-07333f46cab7c10d2f3f77277ef0accf.fontdata" [deps] -source_file="res://font/press-start/prstartk.ttf" -dest_files=["res://.godot/imported/prstartk.ttf-71558b3660967bfa8cc6acae2bc11f53.fontdata"] +source_file="res://interface/font/press-start/prstartk.ttf" +dest_files=["res://.godot/imported/prstartk.ttf-07333f46cab7c10d2f3f77277ef0accf.fontdata"] [params] diff --git a/interface/interface_theme.tres b/interface/interface_theme.tres index 7381328..b771a9a 100644 --- a/interface/interface_theme.tres +++ b/interface/interface_theme.tres @@ -1,6 +1,6 @@ [gd_resource type="Theme" load_steps=2 format=3 uid="uid://ba5utvfhnxa5i"] -[ext_resource type="FontFile" uid="uid://cs8tiwyb76gig" path="res://font/press-start/prstart.ttf" id="1_mtdor"] +[ext_resource type="FontFile" uid="uid://cs8tiwyb76gig" path="res://interface/font/press-start/prstart.ttf" id="1_mtdor"] [resource] default_font = ExtResource("1_mtdor") diff --git a/entity/upgrade_copper.png b/interface/upgrade_copper.png similarity index 100% rename from entity/upgrade_copper.png rename to interface/upgrade_copper.png diff --git a/entity/upgrade_copper.png.import b/interface/upgrade_copper.png.import similarity index 70% rename from entity/upgrade_copper.png.import rename to interface/upgrade_copper.png.import index a785e3b..05eebe0 100644 --- a/entity/upgrade_copper.png.import +++ b/interface/upgrade_copper.png.import @@ -3,15 +3,15 @@ importer="texture" type="CompressedTexture2D" uid="uid://c8pvjgtr2ufjl" -path="res://.godot/imported/upgrade_copper.png-92818496e71584b34e672f67618f806c.ctex" +path="res://.godot/imported/upgrade_copper.png-b956afb6fc6610b1d49938a1f6052d59.ctex" metadata={ "vram_texture": false } [deps] -source_file="res://entity/upgrade_copper.png" -dest_files=["res://.godot/imported/upgrade_copper.png-92818496e71584b34e672f67618f806c.ctex"] +source_file="res://interface/upgrade_copper.png" +dest_files=["res://.godot/imported/upgrade_copper.png-b956afb6fc6610b1d49938a1f6052d59.ctex"] [params] diff --git a/entity/upgrade_gold.png b/interface/upgrade_gold.png similarity index 100% rename from entity/upgrade_gold.png rename to interface/upgrade_gold.png diff --git a/entity/upgrade_gold.png.import b/interface/upgrade_gold.png.import similarity index 71% rename from entity/upgrade_gold.png.import rename to interface/upgrade_gold.png.import index 1cb0962..601475d 100644 --- a/entity/upgrade_gold.png.import +++ b/interface/upgrade_gold.png.import @@ -3,15 +3,15 @@ importer="texture" type="CompressedTexture2D" uid="uid://taojrwr7xrp4" -path="res://.godot/imported/upgrade_gold.png-a48bc75df5dc8202543af64ada12eda4.ctex" +path="res://.godot/imported/upgrade_gold.png-a89db133417edfc914df9af570e37a44.ctex" metadata={ "vram_texture": false } [deps] -source_file="res://entity/upgrade_gold.png" -dest_files=["res://.godot/imported/upgrade_gold.png-a48bc75df5dc8202543af64ada12eda4.ctex"] +source_file="res://interface/upgrade_gold.png" +dest_files=["res://.godot/imported/upgrade_gold.png-a89db133417edfc914df9af570e37a44.ctex"] [params] diff --git a/entity/upgrade_silver.png b/interface/upgrade_silver.png similarity index 100% rename from entity/upgrade_silver.png rename to interface/upgrade_silver.png diff --git a/entity/upgrade_silver.png.import b/interface/upgrade_silver.png.import similarity index 70% rename from entity/upgrade_silver.png.import rename to interface/upgrade_silver.png.import index 33c1ebb..5b214c1 100644 --- a/entity/upgrade_silver.png.import +++ b/interface/upgrade_silver.png.import @@ -3,15 +3,15 @@ importer="texture" type="CompressedTexture2D" uid="uid://7b12rwclhrq0" -path="res://.godot/imported/upgrade_silver.png-50b5b05efdbda1c035ad16dd8135bc03.ctex" +path="res://.godot/imported/upgrade_silver.png-42052339b6b6d32d1b2b65c0e0953aef.ctex" metadata={ "vram_texture": false } [deps] -source_file="res://entity/upgrade_silver.png" -dest_files=["res://.godot/imported/upgrade_silver.png-50b5b05efdbda1c035ad16dd8135bc03.ctex"] +source_file="res://interface/upgrade_silver.png" +dest_files=["res://.godot/imported/upgrade_silver.png-42052339b6b6d32d1b2b65c0e0953aef.ctex"] [params] diff --git a/main.tscn b/main.tscn index fe75dc8..8058a33 100644 --- a/main.tscn +++ b/main.tscn @@ -1,17 +1,19 @@ -[gd_scene load_steps=6 format=3 uid="uid://dqm0h5h0baqcg"] +[gd_scene load_steps=8 format=3 uid="uid://dqm0h5h0baqcg"] [ext_resource type="Script" path="res://main.gd" id="1_fqt34"] [ext_resource type="Theme" uid="uid://ba5utvfhnxa5i" path="res://interface/interface_theme.tres" id="1_je7w1"] [ext_resource type="PackedScene" uid="uid://c3rxmcwa5nqng" path="res://game/game.tscn" id="2_32lou"] [ext_resource type="PackedScene" uid="uid://cklkdygv61bny" path="res://interface/shop_ui.tscn" id="2_qj86l"] +[ext_resource type="Script" path="res://interface/custom_ui.gd" id="3_xav0n"] +[ext_resource type="Script" path="res://interface/safe_ui.gd" id="4_nel0n"] [ext_resource type="PackedScene" uid="uid://bo5unrhqpoyim" path="res://interface/game_ui.tscn" id="4_siim3"] [node name="Main" type="Node" node_paths=PackedStringArray("game_ui", "shop_ui")] script = ExtResource("1_fqt34") -game_ui = NodePath("UI/GameUI") -shop_ui = NodePath("UI/ShopUI") +game_ui = NodePath("CustomUI/SafeUI/GameUI") +shop_ui = NodePath("CustomUI/SafeUI/ShopUI") -[node name="UI" type="Control" parent="."] +[node name="CustomUI" type="Control" parent="."] texture_filter = 1 layout_mode = 3 anchors_preset = 15 @@ -21,45 +23,60 @@ grow_horizontal = 2 grow_vertical = 2 size_flags_vertical = 8 theme = ExtResource("1_je7w1") +script = ExtResource("3_xav0n") -[node name="GameWorld" type="CenterContainer" parent="UI"] +[node name="GameWorld" type="CenterContainer" parent="CustomUI"] custom_minimum_size = Vector2(270, 480) layout_mode = 1 +anchors_preset = 7 +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 +grow_horizontal = 2 +grow_vertical = 0 + +[node name="GameViewport" type="SubViewportContainer" parent="CustomUI/GameWorld"] +layout_mode = 2 + +[node name="Viewport" type="SubViewport" parent="CustomUI/GameWorld/GameViewport"] +disable_3d = true +handle_input_locally = false +size = Vector2i(270, 480) +render_target_update_mode = 4 + +[node name="Game" parent="CustomUI/GameWorld/GameViewport/Viewport" instance=ExtResource("2_32lou")] + +[node name="Camera" type="Camera2D" parent="CustomUI/GameWorld/GameViewport/Viewport"] +anchor_mode = 0 + +[node name="SafeUI" type="MarginContainer" parent="CustomUI"] +layout_mode = 1 anchors_preset = 15 anchor_right = 1.0 anchor_bottom = 1.0 grow_horizontal = 2 grow_vertical = 2 +script = ExtResource("4_nel0n") -[node name="GameViewport" type="SubViewportContainer" parent="UI/GameWorld"] +[node name="GameUI" parent="CustomUI/SafeUI" instance=ExtResource("4_siim3")] layout_mode = 2 -[node name="Viewport" type="SubViewport" parent="UI/GameWorld/GameViewport"] -disable_3d = true -handle_input_locally = false -size = Vector2i(270, 480) -render_target_update_mode = 4 - -[node name="Game" parent="UI/GameWorld/GameViewport/Viewport" instance=ExtResource("2_32lou")] - -[node name="Camera" type="Camera2D" parent="UI/GameWorld/GameViewport/Viewport"] -anchor_mode = 0 - -[node name="GameUI" parent="UI" instance=ExtResource("4_siim3")] -layout_mode = 1 - -[node name="ShopUI" parent="UI" instance=ExtResource("2_qj86l")] +[node name="ShopUI" parent="CustomUI/SafeUI" instance=ExtResource("2_qj86l")] process_mode = 3 visible = false -layout_mode = 1 +layout_mode = 2 -[connection signal="score_changed" from="UI/GameWorld/GameViewport/Viewport/Game" to="UI/GameUI" method="_on_game_score_changed"] -[connection signal="score_button_pressed" from="UI/GameUI" to="." method="_on_game_ui_score_button_pressed"] -[connection signal="shop_button_pressed" from="UI/GameUI" to="." method="_on_game_ui_shop_button_pressed"] -[connection signal="spawn_button_pressed" from="UI/GameUI" to="UI/GameWorld/GameViewport/Viewport/Game" method="trigger_spawn"] -[connection signal="back_button_pressed" from="UI/ShopUI" to="." method="_on_shop_ui_back_button_pressed"] -[connection signal="delete_button_pressed" from="UI/ShopUI" to="." method="_on_shop_ui_delete_button_pressed"] -[connection signal="purchase_begin" from="UI/ShopUI" to="." method="_on_shop_ui_purchase_begin"] -[connection signal="purchase_cancel" from="UI/ShopUI" to="." method="_on_shop_ui_purchase_cancel"] -[connection signal="purchase_success" from="UI/ShopUI" to="." method="_on_shop_ui_purchase_success"] -[connection signal="score_button_pressed" from="UI/ShopUI" to="." method="_on_shop_ui_score_button_pressed"] +[connection signal="score_changed" from="CustomUI/GameWorld/GameViewport/Viewport/Game" to="CustomUI/SafeUI/GameUI" method="_on_game_score_changed"] +[connection signal="score_button_pressed" from="CustomUI/SafeUI/GameUI" to="." method="_on_game_ui_score_button_pressed"] +[connection signal="shop_button_pressed" from="CustomUI/SafeUI/GameUI" to="." method="_on_game_ui_shop_button_pressed"] +[connection signal="spawn_button_pressed" from="CustomUI/SafeUI/GameUI" to="CustomUI/GameWorld/GameViewport/Viewport/Game" method="trigger_spawn"] +[connection signal="back_button_pressed" from="CustomUI/SafeUI/ShopUI" to="." method="_on_shop_ui_back_button_pressed"] +[connection signal="delete_button_pressed" from="CustomUI/SafeUI/ShopUI" to="." method="_on_shop_ui_delete_button_pressed"] +[connection signal="purchase_begin" from="CustomUI/SafeUI/ShopUI" to="." method="_on_shop_ui_purchase_begin"] +[connection signal="purchase_cancel" from="CustomUI/SafeUI/ShopUI" to="." method="_on_shop_ui_purchase_cancel"] +[connection signal="purchase_success" from="CustomUI/SafeUI/ShopUI" to="." method="_on_shop_ui_purchase_success"] +[connection signal="score_button_pressed" from="CustomUI/SafeUI/ShopUI" to="." method="_on_shop_ui_score_button_pressed"] diff --git a/project.godot b/project.godot index 84fedfa..2497f77 100644 --- a/project.godot +++ b/project.godot @@ -15,7 +15,7 @@ run/main_scene="res://main.tscn" config/features=PackedStringArray("4.1", "Mobile") boot_splash/bg_color=Color(0.0977035, 0.0977035, 0.10161, 1) boot_splash/image="res://icon.png" -config/icon="res://icon.svg" +config/icon="res://icon.png" [display] diff --git a/spawner/spawner.gd b/spawner/spawner.gd index 820b217..e7c8ba2 100644 --- a/spawner/spawner.gd +++ b/spawner/spawner.gd @@ -52,10 +52,10 @@ func _do_spawn(): if len(get_overlapping_bodies()) > overlapping_body_count_limit: return var instantiated = scene.instantiate() - instantiated.position = position - target.position + _select_spawn_position() + instantiated.global_position = global_position + _select_spawn_position() instantiated.rotation_degrees = _select_spawn_rotation() target.add_child(instantiated) - emit_signal("spawned", instantiated) + spawned.emit() buffer -= 1 func _physics_process(_delta): diff --git a/sprite_layers.md b/sprite_layers.md new file mode 100644 index 0000000..3534b0f --- /dev/null +++ b/sprite_layers.md @@ -0,0 +1,19 @@ +# Z-layers + +## Z-2 +- Converter background + +## Z-1 +- Coin outline + +## Z+0 +- Default + +## Z+2 +- Converter + +## Z+3 +- Bottle + +## Z+10 +- UI diff --git a/value/evaluator.gd b/value/evaluator.gd index 54d62da..7685381 100644 --- a/value/evaluator.gd +++ b/value/evaluator.gd @@ -16,15 +16,19 @@ signal removed(what: Valuable, total: int) signal changed(total: int) -func _on_body_entered(body: PhysicsBody2D): - var valuable: Valuable = body.get_node("Valuable") - total += valuable.value - added.emit(valuable, total) - changed.emit(total) +func _on_body_entered(body: Node2D): + if body is PhysicsBody2D: + var valuable: Valuable = body.find_child("Valuable", false, false) + if valuable: + total += valuable.value + added.emit(valuable, total) + changed.emit(total) -func _on_body_exited(body: PhysicsBody2D): - var valuable: Valuable = body.get_node("Valuable") - total -= valuable.value - removed.emit(valuable, total) - changed.emit(total) +func _on_body_exited(body: Node2D): + if body is PhysicsBody2D: + var valuable: Valuable = body.find_child("Valuable", false, false) + if valuable: + total -= valuable.value + removed.emit(valuable, total) + changed.emit(total)