mirror of
https://github.com/Steffo99/swear-jar.git
synced 2024-11-25 00:54:19 +00:00
Stuff
This commit is contained in:
parent
9bcda63b84
commit
201252461c
11 changed files with 75 additions and 42 deletions
|
@ -7,6 +7,8 @@ class_name Converter
|
|||
@export var sound_working: AudioStreamPlayer
|
||||
@export var sound_complete: AudioStreamPlayer
|
||||
@export var spawner: Spawner
|
||||
@export var spawner_alt: Spawner
|
||||
@export_range(0.0, 1.0, 0.01) var spawner_alt_chance: float
|
||||
|
||||
## Amount of scenes this converter should produce.
|
||||
var to_produce: int = 0
|
||||
|
@ -32,6 +34,9 @@ func produce():
|
|||
sound_working.play()
|
||||
|
||||
func _on_timer_timeout():
|
||||
if spawner_alt and Randomizer.rng.randf() < spawner_alt_chance:
|
||||
spawner_alt.spawn()
|
||||
else:
|
||||
spawner.spawn()
|
||||
if sprite_front:
|
||||
sprite_front.stop()
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
[gd_scene load_steps=25 format=3 uid="uid://clanhkk4sg47w"]
|
||||
[gd_scene load_steps=26 format=3 uid="uid://clanhkk4sg47w"]
|
||||
|
||||
[ext_resource type="Script" path="res://converters/converter.gd" id="1_mf1ls"]
|
||||
[ext_resource type="Texture2D" uid="uid://2dhqp2liete7" path="res://converters/gold_to_coaldiamond/diamond_converter_back.png" id="2_nj8gd"]
|
||||
|
@ -11,7 +11,8 @@
|
|||
[ext_resource type="PackedScene" uid="uid://c67lfbk4gf1ga" path="res://spawner/spawner.tscn" id="8_yel0k"]
|
||||
[ext_resource type="AudioStream" uid="uid://br25ip30mu174" path="res://audio/conversione/mechanic_sound.wav" id="10_hy4ck"]
|
||||
[ext_resource type="PackedScene" uid="uid://diy8fj7mcc00p" path="res://entity/coal_diamond/coal.tscn" id="10_ry7ak"]
|
||||
[ext_resource type="AudioStream" uid="uid://7tw5efuo3gxj" path="res://audio/conversione/coin_to_coin.wav" id="11_5c46k"]
|
||||
[ext_resource type="PackedScene" uid="uid://cr5tiep20hk0s" path="res://entity/coal_diamond/diamond.tscn" id="11_ekhmr"]
|
||||
[ext_resource type="AudioStream" uid="uid://cc4mqxq6mxmdg" path="res://audio/conversione/coin_to_gem.wav" id="12_pddsd"]
|
||||
[ext_resource type="PackedScene" uid="uid://bevj27e1ha8m3" path="res://converters/converter_placement_body.tscn" id="12_xld3l"]
|
||||
[ext_resource type="AudioStream" uid="uid://du16ilpv6gmxd" path="res://audio/conversione/drop_in_lava.wav" id="13_jvouj"]
|
||||
|
||||
|
@ -55,7 +56,7 @@ animations = [{
|
|||
}],
|
||||
"loop": true,
|
||||
"name": &"default",
|
||||
"speed": 15.0
|
||||
"speed": 10.0
|
||||
}]
|
||||
|
||||
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_aslkt"]
|
||||
|
@ -71,16 +72,19 @@ size = Vector2(26, 5)
|
|||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_jeo5f"]
|
||||
size = Vector2(26, 10)
|
||||
|
||||
[node name="CoalDiamondConverter" type="StaticBody2D" node_paths=PackedStringArray("sprite_front", "conversion_timer", "sound_working", "sound_complete", "spawner")]
|
||||
[node name="CoalDiamondConverter" type="StaticBody2D" node_paths=PackedStringArray("sprite_front", "conversion_timer", "sound_working", "sound_complete", "spawner", "spawner_alt")]
|
||||
scale = Vector2(3, 3)
|
||||
collision_layer = 8
|
||||
collision_mask = 0
|
||||
input_pickable = true
|
||||
script = ExtResource("1_mf1ls")
|
||||
sprite_front = NodePath("SpriteFront")
|
||||
conversion_timer = NodePath("ConversionTimer")
|
||||
sound_working = NodePath("SoundWorking")
|
||||
sound_complete = NodePath("SoundComplete")
|
||||
sound_complete = NodePath("SpawnerAlt/SoundComplete")
|
||||
spawner = NodePath("Spawner")
|
||||
spawner_alt = NodePath("SpawnerAlt")
|
||||
spawner_alt_chance = 0.12
|
||||
|
||||
[node name="SpriteBack" type="Sprite2D" parent="."]
|
||||
z_index = -2
|
||||
|
@ -111,7 +115,7 @@ shape = SubResource("RectangleShape2D_31dtl")
|
|||
|
||||
[node name="Collector" parent="." instance=ExtResource("7_rxm8j")]
|
||||
z_index = 2
|
||||
collecting_types = Array[StringName]([&"Copper"])
|
||||
collecting_types = Array[StringName]([&"Gold"])
|
||||
collecting_amount = 10
|
||||
|
||||
[node name="CollectShape" type="CollisionShape2D" parent="Collector"]
|
||||
|
@ -133,15 +137,32 @@ position = Vector2(0, 3.5)
|
|||
shape = SubResource("RectangleShape2D_jeo5f")
|
||||
debug_color = Color(0.701961, 0, 0, 0.419608)
|
||||
|
||||
[node name="SpawnerAlt" parent="." node_paths=PackedStringArray("sound_complete") instance=ExtResource("8_yel0k")]
|
||||
position = Vector2(0, 8)
|
||||
scene = ExtResource("11_ekhmr")
|
||||
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="SpawnerAlt"]
|
||||
z_index = 3
|
||||
position = Vector2(0, 3.5)
|
||||
shape = SubResource("RectangleShape2D_jeo5f")
|
||||
debug_color = Color(0.701961, 0, 0, 0.419608)
|
||||
|
||||
[node name="SoundComplete" type="AudioStreamPlayer" parent="SpawnerAlt"]
|
||||
stream = ExtResource("12_pddsd")
|
||||
|
||||
[node name="ConversionTimer" type="Timer" parent="."]
|
||||
wait_time = 0.5
|
||||
one_shot = true
|
||||
|
||||
[node name="SoundWorking" type="AudioStreamPlayer" parent="."]
|
||||
stream = ExtResource("10_hy4ck")
|
||||
|
||||
[node name="SoundComplete" type="AudioStreamPlayer" parent="."]
|
||||
stream = ExtResource("11_5c46k")
|
||||
|
||||
[node name="SoundAbsorb" type="AudioStreamPlayer" parent="."]
|
||||
stream = ExtResource("13_jvouj")
|
||||
volume_db = -12.291
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
[ext_resource type="PackedScene" uid="uid://c67lfbk4gf1ga" path="res://spawner/spawner.tscn" id="9_ojqfv"]
|
||||
[ext_resource type="PackedScene" uid="uid://bawprh8kluilq" path="res://entity/gem/gem.tscn" id="10_op7xt"]
|
||||
[ext_resource type="AudioStream" uid="uid://br25ip30mu174" path="res://audio/conversione/mechanic_sound.wav" id="11_lofho"]
|
||||
[ext_resource type="AudioStream" uid="uid://7tw5efuo3gxj" path="res://audio/conversione/coin_to_coin.wav" id="12_vklpo"]
|
||||
[ext_resource type="AudioStream" uid="uid://cc4mqxq6mxmdg" path="res://audio/conversione/coin_to_gem.wav" id="11_sk30q"]
|
||||
[ext_resource type="PackedScene" uid="uid://bevj27e1ha8m3" path="res://converters/converter_placement_body.tscn" id="13_6o73w"]
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_wy1v3"]
|
||||
|
@ -79,7 +79,7 @@ script = ExtResource("1_fgju3")
|
|||
sprite_front = NodePath("SpriteFront")
|
||||
conversion_timer = NodePath("ConversionTimer")
|
||||
sound_working = NodePath("SoundWorking")
|
||||
sound_complete = NodePath("SoundComplete")
|
||||
sound_complete = NodePath("Spawner/SoundComplete")
|
||||
spawner = NodePath("Spawner")
|
||||
|
||||
[node name="SpriteBack" type="Sprite2D" parent="."]
|
||||
|
@ -119,7 +119,7 @@ collecting_amount = 10
|
|||
shape = SubResource("RectangleShape2D_k11if")
|
||||
debug_color = Color(0, 0.701961, 0.188235, 0.419608)
|
||||
|
||||
[node name="Spawner" parent="." instance=ExtResource("9_ojqfv")]
|
||||
[node name="Spawner" parent="." node_paths=PackedStringArray("sound_complete") instance=ExtResource("9_ojqfv")]
|
||||
position = Vector2(0, 8)
|
||||
scene = ExtResource("10_op7xt")
|
||||
buffer_cap = 1
|
||||
|
@ -127,6 +127,7 @@ 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="Spawner"]
|
||||
z_index = 3
|
||||
|
@ -134,6 +135,9 @@ position = Vector2(0, 3.5)
|
|||
shape = SubResource("RectangleShape2D_jeo5f")
|
||||
debug_color = Color(0.701961, 0, 0, 0.419608)
|
||||
|
||||
[node name="SoundComplete" type="AudioStreamPlayer" parent="Spawner"]
|
||||
stream = ExtResource("11_sk30q")
|
||||
|
||||
[node name="ConversionTimer" type="Timer" parent="."]
|
||||
one_shot = true
|
||||
|
||||
|
@ -143,9 +147,6 @@ stream = ExtResource("11_lofho")
|
|||
[node name="SoundWorking" type="AudioStreamPlayer" parent="."]
|
||||
stream = ExtResource("11_lofho")
|
||||
|
||||
[node name="SoundComplete" type="AudioStreamPlayer" parent="."]
|
||||
stream = ExtResource("12_vklpo")
|
||||
|
||||
[node name="ConverterPlacementBody" parent="." instance=ExtResource("13_6o73w")]
|
||||
|
||||
[connection signal="input_event" from="." to="." method="_on_input_event"]
|
||||
|
|
|
@ -55,7 +55,7 @@ script = ExtResource("1_chhfg")
|
|||
sprite_front = NodePath("SpriteFront")
|
||||
conversion_timer = NodePath("ConversionTimer")
|
||||
sound_working = NodePath("SoundWorking")
|
||||
sound_complete = NodePath("SoundComplete")
|
||||
sound_complete = NodePath("Spawner/SoundComplete")
|
||||
spawner = NodePath("Spawner")
|
||||
|
||||
[node name="SpriteBack" type="Sprite2D" parent="."]
|
||||
|
@ -95,7 +95,7 @@ collecting_amount = 10
|
|||
shape = SubResource("RectangleShape2D_k11if")
|
||||
debug_color = Color(0, 0.701961, 0.188235, 0.419608)
|
||||
|
||||
[node name="Spawner" parent="." instance=ExtResource("8_65kmt")]
|
||||
[node name="Spawner" parent="." node_paths=PackedStringArray("sound_complete") instance=ExtResource("8_65kmt")]
|
||||
position = Vector2(0, 8)
|
||||
scene = ExtResource("9_t8y3t")
|
||||
buffer_cap = 1
|
||||
|
@ -103,6 +103,9 @@ 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")
|
||||
sound_complete_pitch_min = 1.1
|
||||
sound_complete_pitch_max = 1.14
|
||||
|
||||
[node name="PreventSpawnShape" type="CollisionShape2D" parent="Spawner"]
|
||||
z_index = 3
|
||||
|
@ -110,6 +113,9 @@ position = Vector2(0, 3.5)
|
|||
shape = SubResource("RectangleShape2D_jeo5f")
|
||||
debug_color = Color(0.701961, 0, 0, 0.419608)
|
||||
|
||||
[node name="SoundComplete" type="AudioStreamPlayer" parent="Spawner"]
|
||||
stream = ExtResource("11_ow0vy")
|
||||
|
||||
[node name="ConversionTimer" type="Timer" parent="."]
|
||||
wait_time = 0.5
|
||||
one_shot = true
|
||||
|
@ -117,9 +123,6 @@ one_shot = true
|
|||
[node name="SoundWorking" type="AudioStreamPlayer" parent="."]
|
||||
stream = ExtResource("10_0dr47")
|
||||
|
||||
[node name="SoundComplete" type="AudioStreamPlayer" parent="."]
|
||||
stream = ExtResource("11_ow0vy")
|
||||
|
||||
[node name="ConverterPlacementBody" parent="." instance=ExtResource("12_37x2h")]
|
||||
|
||||
[connection signal="input_event" from="." to="." method="_on_input_event"]
|
||||
|
|
|
@ -3,15 +3,15 @@
|
|||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://bnfwmlf7ems16"
|
||||
path="res://.godot/imported/coal.png-bae62eb66a24aa48a4fb6fc311fab196.ctex"
|
||||
path="res://.godot/imported/coal.png-f07ec282df843263b53a26da26cd77f6.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://entity/coal.png"
|
||||
dest_files=["res://.godot/imported/coal.png-bae62eb66a24aa48a4fb6fc311fab196.ctex"]
|
||||
source_file="res://entity/coal_diamond/coal.png"
|
||||
dest_files=["res://.godot/imported/coal.png-f07ec282df843263b53a26da26cd77f6.ctex"]
|
||||
|
||||
[params]
|
||||
|
|
@ -1,13 +1,10 @@
|
|||
[gd_scene load_steps=6 format=3 uid="uid://diy8fj7mcc00p"]
|
||||
[gd_scene load_steps=5 format=3 uid="uid://diy8fj7mcc00p"]
|
||||
|
||||
[ext_resource type="PhysicsMaterial" uid="uid://c6kn1an85lccr" path="res://entity/coin_physics_material.tres" id="1_ftt7x"]
|
||||
[ext_resource type="Texture2D" uid="uid://bgq5afrrpc4a3" path="res://entity/coal_diamond/diamond_white.png" id="2_ug7o0"]
|
||||
[ext_resource type="Texture2D" uid="uid://bnfwmlf7ems16" path="res://entity/coal_diamond/coal.png" id="2_ok4kf"]
|
||||
[ext_resource type="PackedScene" uid="uid://bk1vvq5rug01m" path="res://collector/collectible.tscn" id="4_e8hbs"]
|
||||
[ext_resource type="PackedScene" uid="uid://ujpra0s1kpqi" path="res://value/valuable.tscn" id="5_3e4d8"]
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_x6m8s"]
|
||||
radius = 10.5119
|
||||
|
||||
[node name="Coal" type="RigidBody2D"]
|
||||
collision_layer = 4
|
||||
collision_mask = 14
|
||||
|
@ -19,13 +16,13 @@ can_sleep = false
|
|||
linear_damp = 0.1
|
||||
angular_damp = 0.1
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
[node name="CollisionShape2D" type="CollisionPolygon2D" parent="."]
|
||||
scale = Vector2(2, 2)
|
||||
shape = SubResource("CircleShape2D_x6m8s")
|
||||
polygon = PackedVector2Array(-4.5, 8, 4.5, 8, 8.5, 4, 8.5, -3, 3.5, -8, -3.5, -8, -7.5, -4, -8.5, 0, -8.5, 3)
|
||||
|
||||
[node name="Sprite" type="Sprite2D" parent="CollisionShape2D"]
|
||||
texture_filter = 1
|
||||
texture = ExtResource("2_ug7o0")
|
||||
texture = ExtResource("2_ok4kf")
|
||||
|
||||
[node name="Collectible" parent="." instance=ExtResource("4_e8hbs")]
|
||||
type = &"Coal"
|
||||
|
|
|
@ -4,9 +4,7 @@
|
|||
[ext_resource type="Texture2D" uid="uid://bquk2q5g6bst5" path="res://entity/coal_diamond/diamond.png" id="2_abwth"]
|
||||
[ext_resource type="PackedScene" uid="uid://bk1vvq5rug01m" path="res://collector/collectible.tscn" id="3_n4fa5"]
|
||||
[ext_resource type="PackedScene" uid="uid://ujpra0s1kpqi" path="res://value/valuable.tscn" id="4_yfos5"]
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_x6m8s"]
|
||||
radius = 10.5119
|
||||
[ext_resource type="Script" path="res://entity/gem/RandomValue.gd" id="5_g8xmh"]
|
||||
|
||||
[node name="Diamond" type="RigidBody2D"]
|
||||
collision_layer = 4
|
||||
|
@ -19,9 +17,9 @@ can_sleep = false
|
|||
linear_damp = 0.1
|
||||
angular_damp = 0.1
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
[node name="CollisionShape2D" type="CollisionPolygon2D" parent="."]
|
||||
scale = Vector2(2, 2)
|
||||
shape = SubResource("CircleShape2D_x6m8s")
|
||||
polygon = PackedVector2Array(0, 8, 10, -2, 4, -8, -4, -8, -10, -2)
|
||||
|
||||
[node name="Sprite" type="Sprite2D" parent="CollisionShape2D"]
|
||||
texture_filter = 1
|
||||
|
@ -31,6 +29,11 @@ texture = ExtResource("2_abwth")
|
|||
type = &"Diamond"
|
||||
|
||||
[node name="Valuable" parent="." instance=ExtResource("4_yfos5")]
|
||||
value = 1000
|
||||
value = 10000
|
||||
|
||||
[node name="RandomValue" type="Node" parent="Valuable"]
|
||||
script = ExtResource("5_g8xmh")
|
||||
min_value = 9000
|
||||
max_value = 16000
|
||||
|
||||
[connection signal="collected" from="Collectible" to="Collectible" method="_on_done" flags=18]
|
||||
|
|
|
@ -10,8 +10,8 @@
|
|||
[ext_resource type="AudioStream" uid="uid://br25ip30mu174" path="res://audio/conversione/mechanic_sound.wav" id="6_svrnw"]
|
||||
|
||||
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_jkfas"]
|
||||
radius = 4.0
|
||||
height = 10.0
|
||||
radius = 3.5
|
||||
height = 9.0
|
||||
|
||||
[node name="Gem" type="RigidBody2D"]
|
||||
collision_layer = 4
|
||||
|
|
|
@ -102,6 +102,9 @@ func _on_ghost_materialize():
|
|||
var spawner = instantiated.find_child("Spawner")
|
||||
if spawner != null:
|
||||
spawner.target = self
|
||||
var spawner_alt = instantiated.find_child("SpawnerAlt")
|
||||
if spawner_alt != null:
|
||||
spawner_alt.target = self
|
||||
|
||||
func _on_shop_ui_delete_begin():
|
||||
var converters = find_children("*", "Converter", true, false)
|
||||
|
|
|
@ -32,8 +32,8 @@ var buffer: int = 0
|
|||
## Doesn't spawn anything if not set.
|
||||
@export var sound_complete: AudioStreamPlayer
|
||||
|
||||
@export_range(0.01, 8.0, 0.01, "or_greater") var sound_complete_pitch_min: float = 0.98
|
||||
@export_range(0.01, 8.0, 0.01, "or_greater") var sound_complete_pitch_max: float = 1.02
|
||||
@export_range(0.01, 8.0, 0.01, "or_greater") var sound_complete_pitch_min: float = 1.00
|
||||
@export_range(0.01, 8.0, 0.01, "or_greater") var sound_complete_pitch_max: float = 1.00
|
||||
|
||||
|
||||
signal spawned(what: Node2D)
|
||||
|
|
Loading…
Reference in a new issue