1
Fork 0
mirror of https://github.com/Steffo99/swear-jar.git synced 2024-11-25 17:14:20 +00:00
This commit is contained in:
Matteo Balugani 2023-10-02 15:50:25 +02:00
parent a17d7ce705
commit 7c4af0e6c7
7 changed files with 181 additions and 54 deletions

View file

@ -0,0 +1,139 @@
[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]

View file

@ -9,7 +9,7 @@
[ext_resource type="PackedScene" uid="uid://c5w3b55aiui6c" path="res://collector/collector.tscn" id="7_m34js"] [ext_resource type="PackedScene" uid="uid://c5w3b55aiui6c" path="res://collector/collector.tscn" id="7_m34js"]
[ext_resource type="Texture2D" uid="uid://bfxmurfe4o44s" path="res://entity/gold_converter_front_5.png" id="7_w8dcp"] [ext_resource type="Texture2D" uid="uid://bfxmurfe4o44s" path="res://entity/gold_converter_front_5.png" id="7_w8dcp"]
[ext_resource type="PackedScene" uid="uid://c67lfbk4gf1ga" path="res://spawner/spawner.tscn" id="8_qwbjp"] [ext_resource type="PackedScene" uid="uid://c67lfbk4gf1ga" path="res://spawner/spawner.tscn" id="8_qwbjp"]
[ext_resource type="PackedScene" uid="uid://du3005kwybbrh" path="res://entity/coin_gold/coin_gold.tscn" id="10_5hiv4"] [ext_resource type="PackedScene" uid="uid://w2er6cmul5yx" path="res://entity/gem/gem.tscn" id="9_2ugi1"]
[ext_resource type="AudioStream" uid="uid://br25ip30mu174" path="res://audio/conversione/mechanic_sound.wav" id="10_f1h6i"] [ext_resource type="AudioStream" uid="uid://br25ip30mu174" path="res://audio/conversione/mechanic_sound.wav" id="10_f1h6i"]
[ext_resource type="AudioStream" uid="uid://7tw5efuo3gxj" path="res://audio/conversione/coin_to_coin.wav" id="11_ywwn2"] [ext_resource type="AudioStream" uid="uid://7tw5efuo3gxj" path="res://audio/conversione/coin_to_coin.wav" id="11_ywwn2"]
@ -69,9 +69,14 @@ size = Vector2(26, 5)
[sub_resource type="RectangleShape2D" id="RectangleShape2D_jeo5f"] [sub_resource type="RectangleShape2D" id="RectangleShape2D_jeo5f"]
size = Vector2(26, 8.83334) size = Vector2(26, 8.83334)
[node name="GemConverter" type="StaticBody2D"] [node name="GemConverter" type="StaticBody2D" node_paths=PackedStringArray("sprite_front", "conversion_timer", "sound_working", "sound_complete", "spawner")]
scale = Vector2(3, 3) scale = Vector2(3, 3)
script = ExtResource("1_f5plk") script = ExtResource("1_f5plk")
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="."] [node name="SpriteBack" type="Sprite2D" parent="."]
z_index = -2 z_index = -2
@ -112,7 +117,7 @@ debug_color = Color(0, 0.701961, 0.188235, 0.419608)
[node name="Spawner" parent="." instance=ExtResource("8_qwbjp")] [node name="Spawner" parent="." instance=ExtResource("8_qwbjp")]
position = Vector2(0, 8) position = Vector2(0, 8)
scene = ExtResource("10_5hiv4") scene = ExtResource("9_2ugi1")
buffer_cap = 1 buffer_cap = 1
spawn_rect = Rect2(-8, 0, 16, 4) spawn_rect = Rect2(-8, 0, 16, 4)
spawn_rotation_degrees_min = 80.0 spawn_rotation_degrees_min = 80.0

View file

@ -1,38 +1,27 @@
#extends RigidBody2D #extends RigidBody2D
# #
#@export var sound_touch: AudioStreamPlayer
# #
## Called when the node enters the scene tree for the first time. #var touched=false
#func _ready(): #var was_sleeping: bool = false
# pass # Replace with function body.
# #
#func set_touched():
# touched=true
# #
## Called every frame. 'delta' is the elapsed time since the previous frame. #func _on_sleeping_state_changed():
# was_sleeping = true
#
extends RigidBody2D #func _on_body_entered(body):
# if not was_sleeping:
@export var sound_touch: AudioStreamPlayer # if touched==false and $Timer.is_stopped():
# #$sound_touch.play()
var touched=false # $Timer.start()
var was_sleeping: bool = false # var other_node=body
# if other_node.has_method("set_touched"):
func set_touched(): # other_node.set_touched()
touched=true #
#func _on_body_exited(body):
func _on_sleeping_state_changed(): # touched=false
was_sleeping = true
func _on_body_entered(body):
if not was_sleeping:
if touched==false and $Timer.is_stopped():
#$sound_touch.play()
$Timer.start()
var other_node=body
if other_node.has_method("set_touched"):
other_node.set_touched()
func _on_body_exited(body):
touched=false

View file

@ -11,7 +11,7 @@
[sub_resource type="RectangleShape2D" id="RectangleShape2D_c6byl"] [sub_resource type="RectangleShape2D" id="RectangleShape2D_c6byl"]
size = Vector2(14, 3) size = Vector2(14, 3)
[node name="CoinCopper" type="RigidBody2D" node_paths=PackedStringArray("sound_touch")] [node name="CoinCopper" type="RigidBody2D"]
collision_layer = 5 collision_layer = 5
collision_mask = 7 collision_mask = 7
inertia = 1000.0 inertia = 1000.0
@ -22,7 +22,6 @@ contact_monitor = true
linear_damp = 0.1 linear_damp = 0.1
angular_damp = 0.1 angular_damp = 0.1
script = ExtResource("2_1r8w3") script = ExtResource("2_1r8w3")
sound_touch = NodePath("sound_touch")
[node name="CollisionShape2D" type="CollisionShape2D" parent="."] [node name="CollisionShape2D" type="CollisionShape2D" parent="."]
scale = Vector2(2, 2) scale = Vector2(2, 2)

View file

View file

@ -11,12 +11,11 @@
[ext_resource type="PackedScene" uid="uid://du3005kwybbrh" path="res://entity/coin_gold/coin_gold.tscn" id="7_hh80i"] [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://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://but1bdslxp5jl" path="res://converters/silver_to_gold/silver_converter.tscn" id="8_0bbpi"]
[ext_resource type="PackedScene" 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://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="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="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="Texture2D" uid="uid://c8pvjgtr2ufjl" path="res://interface/upgrade_copper.png" id="11_lt33g"]
[ext_resource type="PackedScene" uid="uid://qtk4tm6l367w" path="res://interface/ghost.tscn" id="16_8vhx6"] [ext_resource type="PackedScene" uid="uid://c4ew8x4gch275" path="res://converters/gold_to_gem/gem_converter.tscn" id="16_e62br"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_4uksi"] [sub_resource type="RectangleShape2D" id="RectangleShape2D_4uksi"]
size = Vector2(80, 80) size = Vector2(80, 80)
@ -40,16 +39,11 @@ upgrade_copper_texture = ExtResource("11_lt33g")
upgrade_silver_texture = ExtResource("3_8wvr1") upgrade_silver_texture = ExtResource("3_8wvr1")
upgrade_gold_texture = ExtResource("4_i557v") upgrade_gold_texture = ExtResource("4_i557v")
[node name="Ghost" parent="." instance=ExtResource("16_8vhx6")]
position = Vector2(90, 306)
collision_layer = 8
collision_mask = 6
[node name="Bottle" parent="." instance=ExtResource("1_y7o2l")] [node name="Bottle" parent="." instance=ExtResource("1_y7o2l")]
[node name="TimeSpawner" parent="." node_paths=PackedStringArray("target") instance=ExtResource("3_qwsty")] [node name="TimeSpawner" parent="." node_paths=PackedStringArray("target") instance=ExtResource("3_qwsty")]
position = Vector2(136, 0) position = Vector2(136, 0)
scene = ExtResource("8_a3sk0") scene = ExtResource("7_hh80i")
target = NodePath("..") target = NodePath("..")
buffer_cap = 1 buffer_cap = 1
spawn_rect = Rect2(-20, 0, 40, 0) spawn_rect = Rect2(-20, 0, 40, 0)
@ -87,7 +81,7 @@ shape = SubResource("RectangleShape2D_rh35r")
debug_color = Color(0, 0.6, 0.701961, 0) debug_color = Color(0, 0.6, 0.701961, 0)
[node name="CopperConverter" parent="." instance=ExtResource("7_ipeok")] [node name="CopperConverter" parent="." instance=ExtResource("7_ipeok")]
position = Vector2(62, 176) position = Vector2(53, 156)
metadata/_edit_group_ = true metadata/_edit_group_ = true
[node name="Spawner" parent="CopperConverter" index="6" node_paths=PackedStringArray("target")] [node name="Spawner" parent="CopperConverter" index="6" node_paths=PackedStringArray("target")]
@ -97,8 +91,12 @@ target = NodePath("../..")
position = Vector2(0, 4.08333) position = Vector2(0, 4.08333)
[node name="SilverConverter" parent="." instance=ExtResource("8_0bbpi")] [node name="SilverConverter" parent="." instance=ExtResource("8_0bbpi")]
position = Vector2(205, 337) position = Vector2(53, 273)
rotation = -3.14159 rotation = -6.28319
metadata/_edit_group_ = true
[node name="CollectShape" parent="SilverConverter/Collector" index="1"]
metadata/_edit_group_ = true
[node name="Spawner" parent="SilverConverter" index="6" node_paths=PackedStringArray("target")] [node name="Spawner" parent="SilverConverter" index="6" node_paths=PackedStringArray("target")]
target = NodePath("../..") target = NodePath("../..")
@ -180,6 +178,10 @@ position = Vector2(405, 540)
shape = SubResource("RectangleShape2D_jed57") shape = SubResource("RectangleShape2D_jed57")
debug_color = Color(0, 0, 0, 0.419608) debug_color = Color(0, 0, 0, 0.419608)
[node name="GemConverter" parent="." instance=ExtResource("16_e62br")]
position = Vector2(144, 184)
metadata/_edit_group_ = true
[connection signal="timeout" from="TimeSpawner/Timer" to="TimeSpawner" method="spawn"] [connection signal="timeout" from="TimeSpawner/Timer" to="TimeSpawner" method="spawn"]
[connection signal="changed" from="Evaluator" to="." method="_on_score_changed"] [connection signal="changed" from="Evaluator" to="." method="_on_score_changed"]
[connection signal="collected" from="StoreCollector" to="." method="_on_store_collector_collected"] [connection signal="collected" from="StoreCollector" to="." method="_on_store_collector_collected"]

View file

@ -6,7 +6,7 @@
[ext_resource type="PackedScene" uid="uid://cklkdygv61bny" path="res://interface/shop_ui.tscn" id="2_qj86l"] [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/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" uid="uid://bo5unrhqpoyim" path="res://interface/game_ui.tscn" id="4_siim3"]
[ext_resource type="PackedScene" uid="uid://bpvx3nkkbluip" path="res://safe_ui.tscn" id="5_2uxda"] [ext_resource type="PackedScene" path="res://safe_ui.tscn" id="5_2uxda"]
[ext_resource type="Script" path="res://game_camera.gd" id="5_xxjtg"] [ext_resource type="Script" path="res://game_camera.gd" id="5_xxjtg"]
[sub_resource type="GDScript" id="GDScript_kyj65"] [sub_resource type="GDScript" id="GDScript_kyj65"]
@ -58,9 +58,6 @@ layout_mode = 1
anchors_preset = 10 anchors_preset = 10
anchor_bottom = 0.0 anchor_bottom = 0.0
grow_vertical = 1 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")] [node name="GameUI" parent="CustomUI/GameSafeUI" instance=ExtResource("4_siim3")]
layout_mode = 2 layout_mode = 2
@ -69,10 +66,6 @@ layout_mode = 2
process_mode = 4 process_mode = 4
visible = false visible = false
layout_mode = 1 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")] [node name="ShopUI" parent="CustomUI/ShopSafeUI" instance=ExtResource("2_qj86l")]
layout_mode = 2 layout_mode = 2