1
Fork 0
mirror of https://github.com/Steffo99/swear-jar.git synced 2024-11-29 02:44:19 +00:00

Fix stuff

This commit is contained in:
Steffo 2023-10-02 23:24:01 +02:00
parent 86ba5252f1
commit 96b685d187
Signed by: steffo
GPG key ID: 2A24051445686895
15 changed files with 232 additions and 76 deletions

View file

@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://db1i6rqitk0e"
path="res://.godot/imported/coal_funny.wav-d8d327344bf0d0b208564592ca1936e9.sample"
[deps]
source_file="res://audio/conversione/coal_funny.wav"
dest_files=["res://.godot/imported/coal_funny.wav-d8d327344bf0d0b208564592ca1936e9.sample"]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop_mode=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=0

View file

@ -3,12 +3,21 @@ class_name Colored
@export var shader: Shader @export var shader: Shader
@onready var hue: float = Randomizer.rng.randf() @onready var hue: float:
get:
return hue
set(value):
hue = value
if parent.material:
parent.material.set_shader_parameter("hue", value)
@onready var parent: Sprite2D = get_parent() @onready var parent: Sprite2D = get_parent()
func _ready(): func _ready():
var material = ShaderMaterial.new() var material = ShaderMaterial.new()
hue = Randomizer.rng.randf()
material.shader = shader material.shader = shader
material.set_shader_parameter("hue", hue)
parent.material = material parent.material = material

View file

@ -13,9 +13,6 @@ class_name Converter
## Amount of scenes this converter should produce. ## Amount of scenes this converter should produce.
var to_produce: int = 0 var to_produce: int = 0
## Amount of scenes this converter should spawn.
var to_spawn: int = 0
func _on_collector_goal(): func _on_collector_goal():
to_produce += 1 to_produce += 1

View file

@ -122,7 +122,7 @@ collecting_amount = 10
shape = SubResource("RectangleShape2D_k11if") shape = SubResource("RectangleShape2D_k11if")
debug_color = Color(0, 0.701961, 0.188235, 0.419608) debug_color = Color(0, 0.701961, 0.188235, 0.419608)
[node name="Spawner" parent="." instance=ExtResource("8_yel0k")] [node name="Spawner" parent="." node_paths=PackedStringArray("sound_complete") instance=ExtResource("8_yel0k")]
position = Vector2(0, 8) position = Vector2(0, 8)
scene = ExtResource("10_ry7ak") scene = ExtResource("10_ry7ak")
buffer_cap = 1 buffer_cap = 1
@ -130,6 +130,7 @@ spawn_rect = Rect2(-8, 0, 16, 4)
spawn_rotation_degrees_min = 80.0 spawn_rotation_degrees_min = 80.0
spawn_rotation_degrees_max = 100.0 spawn_rotation_degrees_max = 100.0
overlapping_body_count_limit = 4 overlapping_body_count_limit = 4
sound_complete = NodePath("SoundComplete")
[node name="PreventSpawnShape" type="CollisionShape2D" parent="Spawner"] [node name="PreventSpawnShape" type="CollisionShape2D" parent="Spawner"]
z_index = 3 z_index = 3
@ -137,6 +138,9 @@ position = Vector2(0, 3.5)
shape = SubResource("RectangleShape2D_jeo5f") shape = SubResource("RectangleShape2D_jeo5f")
debug_color = Color(0.701961, 0, 0, 0.419608) debug_color = Color(0.701961, 0, 0, 0.419608)
[node name="SoundComplete" type="AudioStreamPlayer" parent="Spawner"]
stream = ExtResource("12_pddsd")
[node name="SpawnerAlt" parent="." node_paths=PackedStringArray("sound_complete") instance=ExtResource("8_yel0k")] [node name="SpawnerAlt" parent="." node_paths=PackedStringArray("sound_complete") instance=ExtResource("8_yel0k")]
position = Vector2(0, 8) position = Vector2(0, 8)
scene = ExtResource("11_ekhmr") scene = ExtResource("11_ekhmr")

View file

@ -0,0 +1,87 @@
extends StaticBody2D
class_name ItemConverter
@onready var sprite_front: AnimatedSprite2D = $SpriteFront
@onready var sprite_back: AnimatedSprite2D = $SpriteBack
@onready var sound_working: AudioStreamPlayer = $SoundWorking
@export var crown_chance: float = 0.1
@export var chalice_chance: float = 0.4
@export var required_gold = 25
@onready var stored_gold: int = 0
@onready var gem_hue_ready: Array[float] = []
@onready var gem_hue_stored: Array[float] = []
@onready var gem_hue_spawn: Array[float] = []
@onready var conversion_timer: Timer = $ConversionTimer
@onready var ring_spawner = $RingSpawner
@onready var chalice_spawner = $ChaliceSpawner
@onready var crown_spawner = $CrownSpawner
func _physics_process(_delta):
if conversion_timer.is_stopped():
var hue = gem_hue_stored.pop_front()
if hue:
gem_hue_spawn.append(hue)
conversion_timer.start()
if sprite_front:
sprite_front.play()
if sprite_back:
sprite_back.play()
if sound_working:
sound_working.play()
func try_produce():
if stored_gold >= required_gold and len(gem_hue_ready) >= 1:
stored_gold -= required_gold
gem_hue_stored.append(gem_hue_ready.pop_back())
func _on_timer_timeout():
var rand = Randomizer.rng.randf()
if rand <= crown_chance:
crown_spawner.spawn()
elif rand <= chalice_chance:
chalice_spawner.spawn()
else:
ring_spawner.spawn()
if sprite_front:
sprite_front.stop()
if sprite_back:
sprite_back.stop()
if sound_working:
sound_working.stop()
var is_pending_deletion: bool = false
func pending_deletion():
sprite_front.modulate = Color.RED
is_pending_deletion = true
func ending_deletion():
sprite_front.modulate = Color.WHITE
is_pending_deletion = false
func _on_input_event(_viewport: Node, event: InputEvent, _shape_idx: int):
if is_pending_deletion:
if event is InputEventMouseButton or event is InputEventScreenTouch:
queue_free()
func _on_gem_collector_collected(body: RigidBody2D):
var colored: Colored = body.get_node("CollisionShape2D/Sprite/Colored")
gem_hue_ready.append(colored.hue)
try_produce()
func _on_gold_collector_collected(_body: RigidBody2D):
stored_gold += 1
try_produce()
func _on_spawner_spawned(what: RigidBody2D):
var hue = gem_hue_spawn.pop_front()
if not hue:
push_error("Missing gem hue, defualting to red")
hue = 0
var colored: Colored = what.get_node("CollisionShape2D/Sprite/Colored")
colored.hue = hue

View file

@ -1,6 +1,6 @@
[gd_scene load_steps=45 format=3 uid="uid://ddrhfhebwtq5"] [gd_scene load_steps=35 format=3 uid="uid://ddrhfhebwtq5"]
[ext_resource type="Script" path="res://converters/converter.gd" id="1_qln0a"] [ext_resource type="Script" path="res://converters/item_converter/item_converter.gd" id="1_o3eos"]
[ext_resource type="Texture2D" uid="uid://devcho3gaigt0" path="res://converters/item_converter/item_converter_back_1.png" id="2_136t7"] [ext_resource type="Texture2D" uid="uid://devcho3gaigt0" path="res://converters/item_converter/item_converter_back_1.png" id="2_136t7"]
[ext_resource type="Texture2D" uid="uid://bq54rpw5jufyd" path="res://converters/item_converter/item_converter_back_2.png" id="3_6gyd6"] [ext_resource type="Texture2D" uid="uid://bq54rpw5jufyd" path="res://converters/item_converter/item_converter_back_2.png" id="3_6gyd6"]
[ext_resource type="PackedScene" uid="uid://c5w3b55aiui6c" path="res://collector/collector.tscn" id="3_qehi7"] [ext_resource type="PackedScene" uid="uid://c5w3b55aiui6c" path="res://collector/collector.tscn" id="3_qehi7"]
@ -13,19 +13,11 @@
[ext_resource type="Texture2D" uid="uid://fqerky4lyps8" path="res://converters/item_converter/item_converter_front_3.png" id="9_88mk7"] [ext_resource type="Texture2D" uid="uid://fqerky4lyps8" path="res://converters/item_converter/item_converter_front_3.png" id="9_88mk7"]
[ext_resource type="Texture2D" uid="uid://bw0jgw0jen4lg" path="res://converters/item_converter/item_converter_front_4.png" id="10_fjv52"] [ext_resource type="Texture2D" uid="uid://bw0jgw0jen4lg" path="res://converters/item_converter/item_converter_front_4.png" id="10_fjv52"]
[ext_resource type="Texture2D" uid="uid://4tg81ksibacf" path="res://converters/item_converter/item_converter_front_5.png" id="11_cg5dk"] [ext_resource type="Texture2D" uid="uid://4tg81ksibacf" path="res://converters/item_converter/item_converter_front_5.png" id="11_cg5dk"]
[ext_resource type="PhysicsMaterial" uid="uid://c6kn1an85lccr" path="res://entity/coin_physics_material.tres" id="14_t5rsp"] [ext_resource type="PackedScene" uid="uid://d32fgw4klo4x3" path="res://entity/item/item_crown.tscn" id="14_mioqu"]
[ext_resource type="Texture2D" uid="uid://wpen8vmuyvqv" path="res://entity/item/item_chalice.png" id="15_4mivw"]
[ext_resource type="AudioStream" uid="uid://du16ilpv6gmxd" path="res://audio/conversione/drop_in_lava.wav" id="15_nahnf"] [ext_resource type="AudioStream" uid="uid://du16ilpv6gmxd" path="res://audio/conversione/drop_in_lava.wav" id="15_nahnf"]
[ext_resource type="Texture2D" uid="uid://dvthocklcjh15" path="res://entity/item/item_chalice_gems.png" id="16_b46dj"]
[ext_resource type="AudioStream" uid="uid://dv1e0wiiquxp0" path="res://audio/conversione/lava.wav" id="16_ptmks"] [ext_resource type="AudioStream" uid="uid://dv1e0wiiquxp0" path="res://audio/conversione/lava.wav" id="16_ptmks"]
[ext_resource type="AudioStream" uid="uid://c0uhi1hrejyxg" path="res://audio/conversione/new_item.wav" id="17_4wm4w"] [ext_resource type="AudioStream" uid="uid://c0uhi1hrejyxg" path="res://audio/conversione/new_item.wav" id="17_4wm4w"]
[ext_resource type="PackedScene" uid="uid://vkvtap437nnf" path="res://color/colored.tscn" id="17_ickrn"]
[ext_resource type="PackedScene" uid="uid://bevj27e1ha8m3" path="res://converters/converter_placement_body.tscn" id="17_udaa3"] [ext_resource type="PackedScene" uid="uid://bevj27e1ha8m3" path="res://converters/converter_placement_body.tscn" id="17_udaa3"]
[ext_resource type="Shader" path="res://entity/gem/gem_shading_material.gdshader" id="18_36lk7"]
[ext_resource type="PackedScene" uid="uid://bk1vvq5rug01m" path="res://collector/collectible.tscn" id="19_ih6j4"]
[ext_resource type="PackedScene" uid="uid://ujpra0s1kpqi" path="res://value/valuable.tscn" id="20_rkbv1"]
[ext_resource type="Script" path="res://entity/gem/RandomValue.gd" id="21_wmo4c"]
[ext_resource type="AudioStream" uid="uid://br25ip30mu174" path="res://audio/conversione/mechanic_sound.wav" id="22_5s1fv"]
[sub_resource type="AtlasTexture" id="AtlasTexture_uqtie"] [sub_resource type="AtlasTexture" id="AtlasTexture_uqtie"]
atlas = ExtResource("2_136t7") atlas = ExtResource("2_136t7")
@ -67,7 +59,7 @@ animations = [{
}], }],
"loop": true, "loop": true,
"name": &"default", "name": &"default",
"speed": 5.0 "speed": 10.0
}] }]
[sub_resource type="AtlasTexture" id="AtlasTexture_qnpyk"] [sub_resource type="AtlasTexture" id="AtlasTexture_qnpyk"]
@ -110,7 +102,7 @@ animations = [{
}], }],
"loop": true, "loop": true,
"name": &"default", "name": &"default",
"speed": 5.0 "speed": 10.0
}] }]
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_aslkt"] [sub_resource type="CapsuleShape2D" id="CapsuleShape2D_aslkt"]
@ -123,37 +115,15 @@ size = Vector2(26, 4)
[sub_resource type="RectangleShape2D" id="RectangleShape2D_k11if"] [sub_resource type="RectangleShape2D" id="RectangleShape2D_k11if"]
size = Vector2(26, 5) size = Vector2(26, 5)
[sub_resource type="CircleShape2D" id="CircleShape2D_hwdjv"]
radius = 18.5017
[sub_resource type="PackedScene" id="PackedScene_srx0t"]
_bundled = {
"conn_count": 1,
"conns": PackedInt32Array(5, 5, 30, 29, 18, 0, 0),
"editable_instances": [],
"names": PackedStringArray("Item", "collision_layer", "collision_mask", "mass", "inertia", "physics_material_override", "continuous_cd", "linear_damp", "angular_damp", "RigidBody2D", "CollisionShape2D", "scale", "shape", "Sprite2D", "texture_filter", "texture", "Sprite", "Colored", "shader", "Collectible", "type", "Valuable", "value", "RandomValue", "script", "Node", "SoundWorking", "stream", "AudioStreamPlayer", "_on_done", "collected"),
"node_count": 9,
"node_paths": [],
"nodes": PackedInt32Array(-1, -1, 9, 0, -1, 8, 1, 0, 2, 1, 3, 2, 4, 3, 5, 4, 6, 5, 7, 6, 8, 6, 0, 0, 0, 10, 10, -1, 2, 11, 7, 12, 8, 0, 1, 0, 13, 13, -1, 2, 14, 5, 15, 9, 0, 1, 0, 13, 16, -1, 2, 14, 5, 15, 10, 0, 3, 0, 2147483647, 17, 11, 1, 18, 12, 0, 0, 0, 2147483647, 19, 13, 1, 20, 14, 0, 0, 0, 2147483647, 21, 15, 1, 22, 16, 0, 6, 0, 25, 23, -1, 1, 24, 17, 0, 0, 0, 28, 26, -1, 1, 27, 18, 0),
"variants": [5, 7, 1.5, 800.0, ExtResource("14_t5rsp"), 1, 0.1, Vector2(4, 4), SubResource("CircleShape2D_hwdjv"), ExtResource("15_4mivw"), ExtResource("16_b46dj"), ExtResource("17_ickrn"), ExtResource("18_36lk7"), ExtResource("19_ih6j4"), &"Gem", ExtResource("20_rkbv1"), 10, ExtResource("21_wmo4c"), ExtResource("22_5s1fv")],
"version": 3
}
[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="ItemConverter" type="StaticBody2D" node_paths=PackedStringArray("sprite_front", "sprite_back", "conversion_timer", "sound_working", "sound_complete", "spawner")] [node name="ItemConverter" type="StaticBody2D"]
scale = Vector2(3, 3) scale = Vector2(3, 3)
collision_layer = 8 collision_layer = 8
collision_mask = 0 collision_mask = 0
input_pickable = true input_pickable = true
script = ExtResource("1_qln0a") script = ExtResource("1_o3eos")
sprite_front = NodePath("SpriteFront")
sprite_back = NodePath("SpriteBack")
conversion_timer = NodePath("ConversionTimer")
sound_working = NodePath("SoundWorking")
sound_complete = NodePath("SoundComplete")
spawner = NodePath("Spawner")
[node name="SpriteBack" type="AnimatedSprite2D" parent="."] [node name="SpriteBack" type="AnimatedSprite2D" parent="."]
texture_filter = 1 texture_filter = 1
@ -182,32 +152,76 @@ position = Vector2(0, 4.5)
rotation = 3.14159 rotation = 3.14159
shape = SubResource("RectangleShape2D_31dtl") shape = SubResource("RectangleShape2D_31dtl")
[node name="Collector" parent="." node_paths=PackedStringArray("sound_absorb") instance=ExtResource("3_qehi7")] [node name="GoldCollector" parent="." node_paths=PackedStringArray("sound_absorb") instance=ExtResource("3_qehi7")]
z_index = 2 z_index = 2
collecting_types = Array[StringName]([&"Gold", &"Gem"]) collecting_types = Array[StringName]([&"Gold"])
sound_absorb = NodePath("../SoundAbsorb") sound_absorb = NodePath("../SoundAbsorb")
collecting_amount = 10 collecting_amount = 25
[node name="CollectShape" type="CollisionShape2D" parent="Collector"] [node name="CollectShape" type="CollisionShape2D" parent="GoldCollector"]
shape = SubResource("RectangleShape2D_k11if") shape = SubResource("RectangleShape2D_k11if")
debug_color = Color(0, 0.701961, 0.188235, 0.419608) debug_color = Color(0, 0.701961, 0.188235, 0.419608)
[node name="Spawner" parent="." instance=ExtResource("4_ihtl7")] [node name="GemCollector" parent="." node_paths=PackedStringArray("sound_absorb") instance=ExtResource("3_qehi7")]
z_index = 2
collecting_types = Array[StringName]([&"Gem"])
sound_absorb = NodePath("../SoundAbsorb")
collecting_amount = 10
[node name="CollectShape" type="CollisionShape2D" parent="GemCollector"]
shape = SubResource("RectangleShape2D_k11if")
debug_color = Color(0, 0.701961, 0.188235, 0.419608)
[node name="RingSpawner" parent="." node_paths=PackedStringArray("sound_complete") instance=ExtResource("4_ihtl7")]
position = Vector2(0, 8) position = Vector2(0, 8)
scene = SubResource("PackedScene_srx0t") scene = ExtResource("14_mioqu")
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
spawn_rotation_degrees_max = 100.0 spawn_rotation_degrees_max = 100.0
overlapping_body_count_limit = 4 overlapping_body_count_limit = 4
sound_complete = NodePath("../SoundComplete")
[node name="PreventSpawnShape" type="CollisionShape2D" parent="Spawner"] [node name="PreventSpawnShape" type="CollisionShape2D" parent="RingSpawner"]
z_index = 3
position = Vector2(0, 3.5)
shape = SubResource("RectangleShape2D_jeo5f")
debug_color = Color(0.701961, 0, 0, 0.419608)
[node name="ChaliceSpawner" parent="." node_paths=PackedStringArray("sound_complete") instance=ExtResource("4_ihtl7")]
position = Vector2(0, 8)
scene = ExtResource("14_mioqu")
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
sound_complete = NodePath("../SoundComplete")
[node name="PreventSpawnShape" type="CollisionShape2D" parent="ChaliceSpawner"]
z_index = 3
position = Vector2(0, 3.5)
shape = SubResource("RectangleShape2D_jeo5f")
debug_color = Color(0.701961, 0, 0, 0.419608)
[node name="CrownSpawner" parent="." node_paths=PackedStringArray("sound_complete") instance=ExtResource("4_ihtl7")]
position = Vector2(0, 8)
scene = ExtResource("14_mioqu")
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
sound_complete = NodePath("../SoundComplete")
[node name="PreventSpawnShape" type="CollisionShape2D" parent="CrownSpawner"]
z_index = 3 z_index = 3
position = Vector2(0, 3.5) position = Vector2(0, 3.5)
shape = SubResource("RectangleShape2D_jeo5f") shape = SubResource("RectangleShape2D_jeo5f")
debug_color = Color(0.701961, 0, 0, 0.419608) debug_color = Color(0.701961, 0, 0, 0.419608)
[node name="ConversionTimer" type="Timer" parent="."] [node name="ConversionTimer" type="Timer" parent="."]
wait_time = 0.5
one_shot = true one_shot = true
[node name="SoundAbsorb" type="AudioStreamPlayer" parent="."] [node name="SoundAbsorb" type="AudioStreamPlayer" parent="."]
@ -228,6 +242,9 @@ frame_progress = 0.228399
[node name="ConverterPlacementBody" parent="." instance=ExtResource("17_udaa3")] [node name="ConverterPlacementBody" parent="." instance=ExtResource("17_udaa3")]
[connection signal="input_event" from="." to="." method="_on_input_event"] [connection signal="input_event" from="." to="." method="_on_input_event"]
[connection signal="collected" from="Collector" to="." method="_on_collector_collected" flags=18] [connection signal="collected" from="GoldCollector" to="." method="_on_gold_collector_collected"]
[connection signal="goal" from="Collector" to="." method="_on_collector_goal" flags=18] [connection signal="collected" from="GemCollector" to="." method="_on_gem_collector_collected"]
[connection signal="spawned" from="RingSpawner" to="." method="_on_spawner_spawned"]
[connection signal="spawned" from="ChaliceSpawner" to="." method="_on_spawner_spawned"]
[connection signal="spawned" from="CrownSpawner" to="." method="_on_spawner_spawned"]
[connection signal="timeout" from="ConversionTimer" to="." method="_on_timer_timeout" flags=18] [connection signal="timeout" from="ConversionTimer" to="." method="_on_timer_timeout" flags=18]

View file

@ -7,7 +7,7 @@
[ext_resource type="PackedScene" uid="uid://ujpra0s1kpqi" path="res://value/valuable.tscn" id="5_palpv"] [ext_resource type="PackedScene" uid="uid://ujpra0s1kpqi" path="res://value/valuable.tscn" id="5_palpv"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_c6byl"] [sub_resource type="RectangleShape2D" id="RectangleShape2D_c6byl"]
size = Vector2(20, 16) size = Vector2(27, 5)
[node name="CoinGold" type="RigidBody2D"] [node name="CoinGold" type="RigidBody2D"]
collision_layer = 4 collision_layer = 4

View file

@ -16,8 +16,8 @@ height = 9.0
[node name="Gem" type="RigidBody2D"] [node name="Gem" type="RigidBody2D"]
collision_layer = 4 collision_layer = 4
collision_mask = 14 collision_mask = 14
mass = 2.5 mass = 1.5
inertia = 500.0 inertia = 800.0
physics_material_override = ExtResource("1_vmemd") physics_material_override = ExtResource("1_vmemd")
continuous_cd = 1 continuous_cd = 1
can_sleep = false can_sleep = false

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=11 format=3 uid="uid://451ddbtq4163"] [gd_scene load_steps=10 format=3 uid="uid://451ddbtq4163"]
[ext_resource type="PhysicsMaterial" uid="uid://c6kn1an85lccr" path="res://entity/coin_physics_material.tres" id="1_vp2el"] [ext_resource type="PhysicsMaterial" uid="uid://c6kn1an85lccr" path="res://entity/coin_physics_material.tres" id="1_vp2el"]
[ext_resource type="Texture2D" uid="uid://wpen8vmuyvqv" path="res://entity/item/item_chalice.png" id="2_rnc33"] [ext_resource type="Texture2D" uid="uid://wpen8vmuyvqv" path="res://entity/item/item_chalice.png" id="2_rnc33"]
@ -10,8 +10,6 @@
[ext_resource type="Script" path="res://entity/gem/RandomValue.gd" id="8_87qrp"] [ext_resource type="Script" path="res://entity/gem/RandomValue.gd" id="8_87qrp"]
[ext_resource type="AudioStream" uid="uid://br25ip30mu174" path="res://audio/conversione/mechanic_sound.wav" id="9_v6jws"] [ext_resource type="AudioStream" uid="uid://br25ip30mu174" path="res://audio/conversione/mechanic_sound.wav" id="9_v6jws"]
[sub_resource type="ConcavePolygonShape2D" id="ConcavePolygonShape2D_n5iil"]
[node name="ItemChalice" type="RigidBody2D"] [node name="ItemChalice" type="RigidBody2D"]
collision_layer = 5 collision_layer = 5
collision_mask = 7 collision_mask = 7
@ -22,9 +20,9 @@ continuous_cd = 1
linear_damp = 0.1 linear_damp = 0.1
angular_damp = 0.1 angular_damp = 0.1
[node name="CollisionShape2D" type="CollisionShape2D" parent="."] [node name="CollisionShape2D" type="CollisionPolygon2D" parent="."]
scale = Vector2(4, 4) scale = Vector2(2, 2)
shape = SubResource("ConcavePolygonShape2D_n5iil") polygon = PackedVector2Array(0, -15, -11.5, -13, -10.5, -1, -2.5, 5, -2.5, 8, -8.5, 12, -4.5, 15, 4.5, 15, 8.5, 12, 2.5, 8, 2.5, 5, 10.5, -1, 11.5, -12.75)
[node name="Sprite2D" type="Sprite2D" parent="CollisionShape2D"] [node name="Sprite2D" type="Sprite2D" parent="CollisionShape2D"]
texture_filter = 1 texture_filter = 1

View file

@ -10,11 +10,11 @@
[ext_resource type="Script" path="res://entity/gem/RandomValue.gd" id="8_utkrs"] [ext_resource type="Script" path="res://entity/gem/RandomValue.gd" id="8_utkrs"]
[ext_resource type="AudioStream" uid="uid://br25ip30mu174" path="res://audio/conversione/mechanic_sound.wav" id="9_6xmfi"] [ext_resource type="AudioStream" uid="uid://br25ip30mu174" path="res://audio/conversione/mechanic_sound.wav" id="9_6xmfi"]
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_jkfas"] [sub_resource type="CircleShape2D" id="CircleShape2D_058rf"]
radius = 13.25 radius = 12.25
height = 32.0
[node name="ItemCrown" type="RigidBody2D"] [node name="ItemCrown" type="RigidBody2D"]
scale = Vector2(2, 2)
collision_layer = 5 collision_layer = 5
collision_mask = 7 collision_mask = 7
mass = 2.8 mass = 2.8
@ -26,7 +26,7 @@ angular_damp = 0.1
[node name="CollisionShape2D" type="CollisionShape2D" parent="."] [node name="CollisionShape2D" type="CollisionShape2D" parent="."]
scale = Vector2(4, 4) scale = Vector2(4, 4)
shape = SubResource("CapsuleShape2D_jkfas") shape = SubResource("CircleShape2D_058rf")
[node name="Sprite2D" type="Sprite2D" parent="CollisionShape2D"] [node name="Sprite2D" type="Sprite2D" parent="CollisionShape2D"]
texture_filter = 1 texture_filter = 1

View file

@ -12,7 +12,7 @@
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_ka4h2"] [sub_resource type="CapsuleShape2D" id="CapsuleShape2D_ka4h2"]
radius = 5.64 radius = 5.64
height = 17.01 height = 14.5
[node name="ItemRing" type="RigidBody2D"] [node name="ItemRing" type="RigidBody2D"]
collision_layer = 5 collision_layer = 5
@ -25,7 +25,7 @@ linear_damp = 0.1
angular_damp = 0.1 angular_damp = 0.1
[node name="CollisionShape2D" type="CollisionShape2D" parent="."] [node name="CollisionShape2D" type="CollisionShape2D" parent="."]
scale = Vector2(4, 4) scale = Vector2(2, 2)
shape = SubResource("CapsuleShape2D_ka4h2") shape = SubResource("CapsuleShape2D_ka4h2")
[node name="Sprite2D" type="Sprite2D" parent="CollisionShape2D"] [node name="Sprite2D" type="Sprite2D" parent="CollisionShape2D"]

View file

@ -99,19 +99,21 @@ func _on_ghost_materialize():
if not instantiated: if not instantiated:
print("[Game] The ghost can't materialize; the spawning is cancelled!") print("[Game] The ghost can't materialize; the spawning is cancelled!")
return return
var spawner = instantiated.find_child("Spawner") for spawner in instantiated.find_children("*", "Spawner", true, false):
if spawner != null:
spawner.target = self spawner.target = self
var spawner_alt = instantiated.find_child("SpawnerAlt")
if spawner_alt != null:
spawner_alt.target = self
func _on_shop_ui_delete_begin(): func _on_shop_ui_delete_begin():
var converters = find_children("*", "Converter", true, false) var converters = find_children("*", "Converter", true, false)
for converter in converters: for converter in converters:
converter.pending_deletion() converter.pending_deletion()
var item_converters = find_children("*", "ItemConverter", true, false)
for converter in item_converters:
converter.pending_deletion()
func _on_shop_ui_delete_end(): func _on_shop_ui_delete_end():
var converters = find_children("*", "Converter", true, false) var converters = find_children("*", "Converter", true, false)
for converter in converters: for converter in converters:
converter.ending_deletion() converter.ending_deletion()
var item_converters = find_children("*", "ItemConverter", true, false)
for converter in item_converters:
converter.pending_deletion()

View file

@ -17,8 +17,8 @@
[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://c3kitncwpi42j" path="res://entity/coin_copper/coin_copper.tscn" id="13_4j8om"] [ext_resource type="PackedScene" uid="uid://c3kitncwpi42j" path="res://entity/coin_copper/coin_copper.tscn" id="13_4j8om"]
[ext_resource type="Script" path="res://game/DebugTimer.gd" id="13_6ai3c"] [ext_resource type="Script" path="res://game/DebugTimer.gd" id="13_6ai3c"]
[ext_resource type="PackedScene" uid="uid://du3005kwybbrh" path="res://entity/coin_gold/coin_gold.tscn" id="13_8ux81"]
[ext_resource type="PackedScene" uid="uid://qtk4tm6l367w" path="res://interface/ghost.tscn" id="16_8vhx6"] [ext_resource type="PackedScene" uid="uid://qtk4tm6l367w" path="res://interface/ghost.tscn" id="16_8vhx6"]
[ext_resource type="PackedScene" uid="uid://ddrhfhebwtq5" path="res://converters/item_converter/item_converter.tscn" id="20_aqj42"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_rh35r"] [sub_resource type="RectangleShape2D" id="RectangleShape2D_rh35r"]
size = Vector2(240, 384) size = Vector2(240, 384)
@ -67,7 +67,6 @@ debug_color = Color(0, 0.6, 0.701961, 0)
[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("13_8ux81")
target = NodePath("..") target = NodePath("..")
buffer_cap = 1 buffer_cap = 1
spawn_rect = Rect2(-20, 0, 40, 0) spawn_rect = Rect2(-20, 0, 40, 0)
@ -79,7 +78,6 @@ shape = SubResource("RectangleShape2D_4uksi")
debug_color = Color(0, 0.6, 0.701961, 0) debug_color = Color(0, 0.6, 0.701961, 0)
[node name="Timer" type="Timer" parent="TimeSpawner"] [node name="Timer" type="Timer" parent="TimeSpawner"]
one_shot = true
[node name="DebugSpawner" parent="." node_paths=PackedStringArray("target") instance=ExtResource("3_qwsty")] [node name="DebugSpawner" parent="." node_paths=PackedStringArray("target") instance=ExtResource("3_qwsty")]
position = Vector2(136, 0) position = Vector2(136, 0)
@ -190,7 +188,24 @@ 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="ItemConverter" parent="." instance=ExtResource("20_aqj42")]
position = Vector2(137, 368)
[node name="GoldCollector" parent="ItemConverter" index="5"]
collecting_types = Array[StringName]([&"Copper"])
[node name="RingSpawner" parent="ItemConverter" index="7" node_paths=PackedStringArray("target")]
target = NodePath("../..")
[node name="ChaliceSpawner" parent="ItemConverter" index="8" node_paths=PackedStringArray("target")]
target = NodePath("../..")
[node name="CrownSpawner" parent="ItemConverter" index="9" node_paths=PackedStringArray("target")]
target = NodePath("../..")
[connection signal="changed" from="Bottle/Evaluator" to="." method="_on_score_changed"] [connection signal="changed" from="Bottle/Evaluator" to="." method="_on_score_changed"]
[connection signal="timeout" from="TimeSpawner/Timer" to="TimeSpawner" method="spawn"] [connection signal="timeout" from="TimeSpawner/Timer" to="TimeSpawner" method="spawn"]
[connection signal="timeout" from="DebugSpawner/DebugTimer" to="DebugSpawner" method="spawn"] [connection signal="timeout" from="DebugSpawner/DebugTimer" to="DebugSpawner" method="spawn"]
[connection signal="collected" from="StoreCollector" to="." method="_on_store_collector_collected"] [connection signal="collected" from="StoreCollector" to="." method="_on_store_collector_collected"]
[editable path="ItemConverter"]

View file

@ -49,6 +49,9 @@ func _on_game_ui_shop_button_pressed():
func _on_shop_ui_purchase_begin(_what): func _on_shop_ui_purchase_begin(_what):
ui_state = UIState.GAME ui_state = UIState.GAME
func _on_shop_ui_purchase_cancel(_what):
ui_state = UIState.GAME
func _on_shop_ui_delete_begin(): func _on_shop_ui_delete_begin():
ui_state = UIState.GAME ui_state = UIState.GAME

View file

@ -73,7 +73,7 @@ func _do_spawn():
if sound_complete: if sound_complete:
sound_complete.pitch_scale = Randomizer.rng.randf_range(sound_complete_pitch_min, sound_complete_pitch_max) sound_complete.pitch_scale = Randomizer.rng.randf_range(sound_complete_pitch_min, sound_complete_pitch_max)
sound_complete.play() sound_complete.play()
spawned.emit() spawned.emit(instantiated)
buffer -= 1 buffer -= 1
func _physics_process(_delta): func _physics_process(_delta):