diff --git a/bottle/bottle.tscn b/bottle/bottle.tscn index 4a862a0..fc6930b 100644 --- a/bottle/bottle.tscn +++ b/bottle/bottle.tscn @@ -105,8 +105,8 @@ texture = ExtResource("1_qvgnf") 4:4/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8) [sub_resource type="TileSet" id="TileSet_tr7be"] -physics_layer_0/collision_layer = 3 -physics_layer_0/collision_mask = 3 +physics_layer_0/collision_layer = 2 +physics_layer_0/collision_mask = 0 physics_layer_0/physics_material = SubResource("PhysicsMaterial_y0g3v") sources/1 = SubResource("TileSetAtlasSource_6tyce") diff --git a/collector/collector.tscn b/collector/collector.tscn index a7f738e..5eb872a 100644 --- a/collector/collector.tscn +++ b/collector/collector.tscn @@ -1,15 +1,10 @@ -[gd_scene load_steps=3 format=3 uid="uid://c5w3b55aiui6c"] +[gd_scene load_steps=2 format=3 uid="uid://c5w3b55aiui6c"] [ext_resource type="Script" path="res://collector/collector.gd" id="1_1xtt5"] -[ext_resource type="AudioStream" uid="uid://bpxjhl0aq3yrv" path="res://audio/conversione/suck2.wav" id="2_n0plc"] -[node name="Collector" type="Area2D" node_paths=PackedStringArray("sound_absorb")] +[node name="Collector" type="Area2D"] +collision_layer = 0 +collision_mask = 4 script = ExtResource("1_1xtt5") -sound_absorb = NodePath("sound_absorb") - -[node name="sound_absorb" type="AudioStreamPlayer" parent="."] -stream = ExtResource("2_n0plc") -volume_db = -8.0 -pitch_scale = 2.0 [connection signal="body_entered" from="." to="." method="_on_body_entered"] diff --git a/converters/FurnaceConverter/furnace_converter.tscn b/converters/FurnaceConverter/furnace_converter.tscn deleted file mode 100644 index 93d6184..0000000 --- a/converters/FurnaceConverter/furnace_converter.tscn +++ /dev/null @@ -1,139 +0,0 @@ -[gd_scene load_steps=21 format=3 uid="uid://c0hcrkf1s2mww"] - -[ext_resource type="Script" path="res://converters/converter.gd" id="1_nl8w8"] -[ext_resource type="Texture2D" uid="uid://440yhlpwpfw4" path="res://converters/copper_to_silver/copper_converter_back.png" id="2_n2t4e"] -[ext_resource type="Texture2D" uid="uid://dq5aowbt2wxec" path="res://converters/copper_to_silver/copper_converter_front_1.png" id="3_5albl"] -[ext_resource type="Texture2D" uid="uid://ck254fewe4l41" path="res://converters/copper_to_silver/copper_converter_front_2.png" id="4_lk7ni"] -[ext_resource type="Texture2D" uid="uid://dg4qq1pgojk8d" path="res://converters/copper_to_silver/copper_converter_front_3.png" id="5_b51qy"] -[ext_resource type="Texture2D" uid="uid://60502lbpup6" path="res://converters/copper_to_silver/copper_converter_front_4.png" id="6_w1me1"] -[ext_resource type="PackedScene" uid="uid://c5w3b55aiui6c" path="res://collector/collector.tscn" id="7_8xgpc"] -[ext_resource type="PackedScene" uid="uid://c67lfbk4gf1ga" path="res://spawner/spawner.tscn" id="8_gdane"] -[ext_resource type="PackedScene" uid="uid://dme22vvfgme5f" path="res://entity/coin_silver/coin_silver.tscn" id="9_scl8h"] -[ext_resource type="AudioStream" uid="uid://br25ip30mu174" path="res://audio/conversione/mechanic_sound.wav" id="10_rm0va"] -[ext_resource type="AudioStream" uid="uid://7tw5efuo3gxj" path="res://audio/conversione/coin_to_coin.wav" id="11_mv2w6"] - -[sub_resource type="AtlasTexture" id="AtlasTexture_62dyi"] -atlas = ExtResource("3_5albl") -region = Rect2(0, 2, 32, 33) - -[sub_resource type="AtlasTexture" id="AtlasTexture_gs3wo"] -atlas = ExtResource("4_lk7ni") -region = Rect2(0, 2, 32, 33) - -[sub_resource type="AtlasTexture" id="AtlasTexture_tboq2"] -atlas = ExtResource("5_b51qy") -region = Rect2(0, 2, 32, 33) - -[sub_resource type="AtlasTexture" id="AtlasTexture_okgf4"] -atlas = ExtResource("6_w1me1") -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, 8.83334) - -[node name="FurnaceConverter" type="StaticBody2D" node_paths=PackedStringArray("sprite_front", "conversion_timer", "sound_working", "sound_complete", "spawner")] -scale = Vector2(3, 3) -script = ExtResource("1_nl8w8") -sprite_front = NodePath("") -conversion_timer = NodePath("") -sound_working = NodePath("") -sound_complete = NodePath("") -spawner = NodePath("") - -[node name="SpriteBack" type="Sprite2D" parent="."] -z_index = -2 -texture_filter = 1 -texture = ExtResource("2_n2t4e") - -[node name="SpriteFront" type="AnimatedSprite2D" parent="."] -z_index = 2 -texture_filter = 1 -sprite_frames = SubResource("SpriteFrames_4m3dg") - -[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="." node_paths=PackedStringArray("sound_absorb") instance=ExtResource("7_8xgpc")] -z_index = 2 -collecting_types = Array[StringName]([&"Copper"]) -sound_absorb = NodePath("") -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_gdane")] -position = Vector2(0, 8) -scene = ExtResource("9_scl8h") -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="SoundAbsorb" type="AudioStreamPlayer" parent="."] -stream = ExtResource("10_rm0va") - -[node name="SoundWorking" type="AudioStreamPlayer" parent="."] -stream = ExtResource("10_rm0va") - -[node name="SoundComplete" type="AudioStreamPlayer" parent="."] -stream = ExtResource("11_mv2w6") - -[connection signal="collected" from="Collector" to="." method="_on_collector_collected" flags=18] -[connection signal="goal" from="Collector" to="." method="_on_collector_goal" flags=18] -[connection signal="timeout" from="ConversionTimer" to="." method="_on_timer_timeout" flags=18] diff --git a/converters/copper_to_silver/copper_converter.tscn b/converters/copper_to_silver/copper_converter.tscn index 3cccf4a..6ae1582 100644 --- a/converters/copper_to_silver/copper_converter.tscn +++ b/converters/copper_to_silver/copper_converter.tscn @@ -59,10 +59,12 @@ size = Vector2(26, 4) size = Vector2(26, 5) [sub_resource type="RectangleShape2D" id="RectangleShape2D_jeo5f"] -size = Vector2(26, 8.83334) +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) +collision_layer = 8 +collision_mask = 0 script = ExtResource("1_mas6k") sprite_front = NodePath("SpriteFront") conversion_timer = NodePath("ConversionTimer") @@ -124,9 +126,6 @@ debug_color = Color(0.701961, 0, 0, 0.419608) wait_time = 0.5 one_shot = true -[node name="SoundAbsorb" type="AudioStreamPlayer" parent="."] -stream = ExtResource("10_6hhch") - [node name="SoundWorking" type="AudioStreamPlayer" parent="."] stream = ExtResource("10_6hhch") diff --git a/converters/gold_to_gem/gem_converter.tscn b/converters/gold_to_gem/gem_converter.tscn index cd40b5b..12fa6f1 100644 --- a/converters/gold_to_gem/gem_converter.tscn +++ b/converters/gold_to_gem/gem_converter.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=23 format=3 uid="uid://c4ew8x4gch275"] +[gd_scene load_steps=17 format=3 uid="uid://c4ew8x4gch275"] [ext_resource type="Script" path="res://converters/converter.gd" id="1_f5plk"] [ext_resource type="Texture2D" uid="uid://chc8wqc1pclbk" path="res://converters/gold_to_gem/gold_converter_back.png" id="2_icys1"] @@ -71,6 +71,8 @@ size = Vector2(26, 8.83334) [node name="GemConverter" type="StaticBody2D" node_paths=PackedStringArray("sprite_front", "conversion_timer", "sound_working", "sound_complete", "spawner")] scale = Vector2(3, 3) +collision_layer = 8 +collision_mask = 0 script = ExtResource("1_f5plk") sprite_front = NodePath("SpriteFront") conversion_timer = NodePath("ConversionTimer") diff --git a/converters/silver_to_gold/silver_converter.tscn b/converters/silver_to_gold/silver_converter.tscn index 3a33122..a365724 100644 --- a/converters/silver_to_gold/silver_converter.tscn +++ b/converters/silver_to_gold/silver_converter.tscn @@ -47,6 +47,8 @@ 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) +collision_layer = 8 +collision_mask = 0 script = ExtResource("1_chhfg") sprite_front = NodePath("SpriteFront") conversion_timer = NodePath("ConversionTimer") diff --git a/game/game.tscn b/game/game.tscn index 3aac1b5..ae72a4d 100644 --- a/game/game.tscn +++ b/game/game.tscn @@ -8,22 +8,21 @@ [ext_resource type="PackedScene" uid="uid://c3kitncwpi42j" path="res://entity/coin_copper/coin_copper.tscn" id="4_5oayc"] [ext_resource type="Texture2D" uid="uid://taojrwr7xrp4" path="res://interface/upgrade_gold.png" id="4_i557v"] [ext_resource type="PackedScene" uid="uid://beg758fa6o0cs" path="res://value/evaluator.tscn" id="6_my6nv"] -[ext_resource type="PackedScene" uid="uid://du3005kwybbrh" path="res://entity/coin_gold/coin_gold.tscn" id="7_hh80i"] [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"] +[ext_resource type="PackedScene" uid="uid://bawprh8kluilq" path="res://entity/gem/gem.tscn" id="8_a3sk0"] [ext_resource type="PackedScene" uid="uid://c2rlx7egl7xiv" path="res://collector/universal_collector.tscn" id="9_7op48"] [ext_resource type="PackedScene" uid="uid://c5w3b55aiui6c" path="res://collector/collector.tscn" id="9_evdhb"] [ext_resource type="Theme" uid="uid://ba5utvfhnxa5i" path="res://interface/interface_theme.tres" id="10_sayqn"] [ext_resource type="Texture2D" uid="uid://c8pvjgtr2ufjl" path="res://interface/upgrade_copper.png" id="11_lt33g"] -[ext_resource type="PackedScene" uid="uid://c4ew8x4gch275" path="res://converters/gold_to_gem/gem_converter.tscn" id="16_e62br"] -[ext_resource type="PackedScene" uid="uid://ddrhfhebwtq5" path="res://converters/item_converter/item_converter.tscn" id="17_fi36f"] - -[sub_resource type="RectangleShape2D" id="RectangleShape2D_4uksi"] -size = Vector2(80, 80) +[ext_resource type="PackedScene" uid="uid://qtk4tm6l367w" path="res://interface/ghost.tscn" id="16_8vhx6"] [sub_resource type="RectangleShape2D" id="RectangleShape2D_rh35r"] size = Vector2(240, 384) +[sub_resource type="RectangleShape2D" id="RectangleShape2D_4uksi"] +size = Vector2(80, 80) + [sub_resource type="RectangleShape2D" id="RectangleShape2D_i50bq"] size = Vector2(540, 135) @@ -40,11 +39,30 @@ upgrade_copper_texture = ExtResource("11_lt33g") upgrade_silver_texture = ExtResource("3_8wvr1") upgrade_gold_texture = ExtResource("4_i557v") +[node name="Ghost" parent="." instance=ExtResource("16_8vhx6")] +position = Vector2(90, 306) + [node name="Bottle" parent="." instance=ExtResource("1_y7o2l")] +[node name="PlaceableArea" type="Area2D" parent="Bottle"] +position = Vector2(136, 272) +collision_layer = 16 +collision_mask = 0 + +[node name="BottleShape" type="CollisionShape2D" parent="Bottle/PlaceableArea"] +shape = SubResource("RectangleShape2D_rh35r") +debug_color = Color(0, 0.6, 0.701961, 0) + +[node name="Evaluator" parent="Bottle" instance=ExtResource("6_my6nv")] +position = Vector2(136, 272) + +[node name="BottleShape" type="CollisionShape2D" parent="Bottle/Evaluator"] +shape = SubResource("RectangleShape2D_rh35r") +debug_color = Color(0, 0.6, 0.701961, 0) + [node name="TimeSpawner" parent="." node_paths=PackedStringArray("target") instance=ExtResource("3_qwsty")] position = Vector2(136, 0) -scene = ExtResource("7_hh80i") +scene = ExtResource("8_a3sk0") target = NodePath("..") buffer_cap = 1 spawn_rect = Rect2(-20, 0, 40, 0) @@ -74,15 +92,8 @@ 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(136, 272) - -[node name="BottleShape" type="CollisionShape2D" parent="Evaluator"] -shape = SubResource("RectangleShape2D_rh35r") -debug_color = Color(0, 0.6, 0.701961, 0) - [node name="CopperConverter" parent="." instance=ExtResource("7_ipeok")] -position = Vector2(-85, 454) +position = Vector2(62, 176) metadata/_edit_group_ = true [node name="Spawner" parent="CopperConverter" index="6" node_paths=PackedStringArray("target")] @@ -92,12 +103,8 @@ target = NodePath("../..") position = Vector2(0, 4.08333) [node name="SilverConverter" parent="." instance=ExtResource("8_0bbpi")] -position = Vector2(-86, 321) -rotation = -6.28319 -metadata/_edit_group_ = true - -[node name="CollectShape" parent="SilverConverter/Collector" index="1"] -metadata/_edit_group_ = true +position = Vector2(205, 337) +rotation = -3.14159 [node name="Spawner" parent="SilverConverter" index="6" node_paths=PackedStringArray("target")] target = NodePath("../..") @@ -179,24 +186,9 @@ position = Vector2(405, 540) shape = SubResource("RectangleShape2D_jed57") debug_color = Color(0, 0, 0, 0.419608) -[node name="GemConverter" parent="." instance=ExtResource("16_e62br")] -position = Vector2(-89, 203) -metadata/_edit_group_ = true - -[node name="Spawner" parent="GemConverter" index="6" node_paths=PackedStringArray("target")] -target = NodePath("../..") - -[node name="ItemConverter" parent="." instance=ExtResource("17_fi36f")] -position = Vector2(136, 378) - -[node name="Spawner" parent="ItemConverter" index="6" node_paths=PackedStringArray("target")] -target = NodePath("../..") - +[connection signal="changed" from="Bottle/Evaluator" to="." method="_on_score_changed"] [connection signal="timeout" from="TimeSpawner/Timer" to="TimeSpawner" method="spawn"] -[connection signal="changed" from="Evaluator" to="." method="_on_score_changed"] [connection signal="collected" from="StoreCollector" to="." method="_on_store_collector_collected"] [editable path="CopperConverter"] [editable path="SilverConverter"] -[editable path="GemConverter"] -[editable path="ItemConverter"] diff --git a/interface/ghost.gd b/interface/ghost.gd index 36e5ca6..47d4f37 100644 --- a/interface/ghost.gd +++ b/interface/ghost.gd @@ -4,6 +4,7 @@ class_name Ghost var is_dragging: bool var previous_position: Vector2 + func _input(event: InputEvent): if event is InputEventMouseButton: is_dragging = event.pressed @@ -15,11 +16,27 @@ func _input(event: InputEvent): if is_dragging: if event is InputEventMouseMotion: var delta = event.position - previous_position - print(delta) - position += delta + move_and_check(position + delta) previous_position = event.position elif event is InputEventScreenDrag: var delta = event.position - previous_position - print(delta) - position += delta + move_and_check(position + delta) previous_position = event.position + + +@onready var sprite: Sprite2D = $Sprite + +@export var can_place: bool: + get: + return can_place + set(value): + if value: + sprite.modulate = Color(1.0, 1.0, 1.0, 0.5) + else: + sprite.modulate = Color(1.0, 0.0, 0.0, 0.5) + + +func move_and_check(destination): + position = destination + can_place = not has_overlapping_bodies() + print(can_place) diff --git a/interface/ghost.tscn b/interface/ghost.tscn index cbf9850..ea08651 100644 --- a/interface/ghost.tscn +++ b/interface/ghost.tscn @@ -8,13 +8,16 @@ size = Vector2(34, 34) [node name="Ghost" type="Area2D"] scale = Vector2(3, 3) +collision_layer = 16 +collision_mask = 10 input_pickable = false script = ExtResource("1_gvls7") [node name="Sprite" type="Sprite2D" parent="."] -modulate = Color(1, 1, 1, 0.470588) +modulate = Color(1, 1, 1, 0.5) z_index = 10 texture = ExtResource("1_lo8gj") [node name="Shape" type="CollisionShape2D" parent="."] shape = SubResource("RectangleShape2D_hmopu") +debug_color = Color(0, 0.6, 0.701961, 0) diff --git a/main.tscn b/main.tscn index f366657..7a2dfb4 100644 --- a/main.tscn +++ b/main.tscn @@ -6,7 +6,7 @@ [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="PackedScene" uid="uid://bo5unrhqpoyim" path="res://interface/game_ui.tscn" id="4_siim3"] -[ext_resource type="PackedScene" path="res://safe_ui.tscn" id="5_2uxda"] +[ext_resource type="PackedScene" uid="uid://bpvx3nkkbluip" path="res://safe_ui.tscn" id="5_2uxda"] [ext_resource type="Script" path="res://game_camera.gd" id="5_xxjtg"] [sub_resource type="GDScript" id="GDScript_kyj65"] @@ -36,7 +36,6 @@ anchor_right = 1.0 anchor_bottom = 1.0 grow_horizontal = 2 grow_vertical = 2 -mouse_default_cursor_shape = 5 stretch = true [node name="Viewport" type="SubViewport" parent="CustomUI/GameViewport"] @@ -58,6 +57,9 @@ layout_mode = 1 anchors_preset = 10 anchor_bottom = 0.0 grow_vertical = 1 +apply_margin_left = true +apply_margin_right = true +apply_margin_top = true [node name="GameUI" parent="CustomUI/GameSafeUI" instance=ExtResource("4_siim3")] layout_mode = 2 @@ -66,6 +68,10 @@ layout_mode = 2 process_mode = 4 visible = false layout_mode = 1 +apply_margin_left = true +apply_margin_right = true +apply_margin_top = true +apply_margin_bottom = true [node name="ShopUI" parent="CustomUI/ShopSafeUI" instance=ExtResource("2_qj86l")] layout_mode = 2 diff --git a/project.godot b/project.godot index 5fdf41d..3dc43a3 100644 --- a/project.godot +++ b/project.godot @@ -30,7 +30,8 @@ window/handheld/orientation=1 2d_physics/layer_1="Default" 2d_physics/layer_2="Bottle" 2d_physics/layer_3="Entities" -2d_physics/layer_4="Ghost" +2d_physics/layer_4="Converter" +2d_physics/layer_5="Ghost" [physics] diff --git a/spawner/spawner.tscn b/spawner/spawner.tscn index 50ad214..a671abf 100644 --- a/spawner/spawner.tscn +++ b/spawner/spawner.tscn @@ -3,4 +3,6 @@ [ext_resource type="Script" path="res://spawner/spawner.gd" id="1_xqfmg"] [node name="Spawner" type="Area2D"] +collision_layer = 0 +collision_mask = 4 script = ExtResource("1_xqfmg") diff --git a/value/evaluator.tscn b/value/evaluator.tscn index e797c93..8474048 100644 --- a/value/evaluator.tscn +++ b/value/evaluator.tscn @@ -3,6 +3,8 @@ [ext_resource type="Script" path="res://value/evaluator.gd" id="1_sjx78"] [node name="Evaluator" type="Area2D"] +collision_layer = 0 +collision_mask = 4 script = ExtResource("1_sjx78") [connection signal="body_entered" from="." to="." method="_on_body_entered"]