1
Fork 0
mirror of https://github.com/Steffo99/swear-jar.git synced 2024-11-21 23:34:18 +00:00

Add silver→gold converter

This commit is contained in:
Steffo 2023-10-02 03:14:45 +02:00
parent bbe2aab4c3
commit 852f8cc0ea
Signed by: steffo
GPG key ID: 2A24051445686895
10 changed files with 218 additions and 14 deletions

View file

@ -1,5 +1,5 @@
extends StaticBody2D
class_name CopperConverter
class_name Converter
var coda : int = 0

View file

@ -3,15 +3,15 @@
importer="texture"
type="CompressedTexture2D"
uid="uid://pj3ip6vlatms"
path="res://.godot/imported/copper_converter.png-73e2763b5acead72621b333dd31febc6.ctex"
path="res://.godot/imported/copper_converter.png-9ce59e2d408b92173733712a087126e5.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://entity/copper_converter.png"
dest_files=["res://.godot/imported/copper_converter.png-73e2763b5acead72621b333dd31febc6.ctex"]
source_file="res://converters/copper_to_silver/copper_converter.png"
dest_files=["res://.godot/imported/copper_converter.png-9ce59e2d408b92173733712a087126e5.ctex"]
[params]

View file

@ -1,6 +1,6 @@
[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="Script" path="res://converters/converter.gd" id="1_mas6k"]
[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"]
@ -63,7 +63,7 @@ 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")
script = ExtResource("1_mas6k")
sprite_front = NodePath("SpriteFront")
conversion_timer = NodePath("ConversionTimer")
sound_working = NodePath("SoundWorking")

BIN
converters/silver_to_gold/silver_converter.png (Stored with Git LFS) Normal file

Binary file not shown.

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bnctqi24r6ycr"
path="res://.godot/imported/silver_converter.png-e20751e6a89ff68eec66a591a74e4834.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://converters/silver_to_gold/silver_converter.png"
dest_files=["res://.godot/imported/silver_converter.png-e20751e6a89ff68eec66a591a74e4834.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

View file

@ -0,0 +1,121 @@
[gd_scene load_steps=17 format=3 uid="uid://but1bdslxp5jl"]
[ext_resource type="Script" path="res://converters/converter.gd" id="1_chhfg"]
[ext_resource type="Texture2D" uid="uid://c1fu70mb51gyd" path="res://converters/silver_to_gold/silver_converter_back.png" id="2_rpdc3"]
[ext_resource type="Texture2D" uid="uid://d3xa3cqu73xjd" path="res://converters/silver_to_gold/silver_converter_front_1.png" id="3_pscuu"]
[ext_resource type="Texture2D" uid="uid://cwycuwkppcjfu" path="res://converters/silver_to_gold/silver_converter_front_2.png" id="4_yq53c"]
[ext_resource type="Texture2D" uid="uid://b006dig4oebpl" path="res://converters/silver_to_gold/silver_converter_front_3.png" id="5_ycslk"]
[ext_resource type="Texture2D" uid="uid://djixrek5573a6" path="res://converters/silver_to_gold/silver_converter_front_4.png" id="6_0qxp1"]
[ext_resource type="PackedScene" uid="uid://c5w3b55aiui6c" path="res://collector/collector.tscn" id="7_3046q"]
[ext_resource type="PackedScene" uid="uid://c67lfbk4gf1ga" path="res://spawner/spawner.tscn" id="8_65kmt"]
[ext_resource type="PackedScene" uid="uid://du3005kwybbrh" path="res://entity/coin_gold/coin_gold.tscn" id="9_t8y3t"]
[ext_resource type="AudioStream" uid="uid://br25ip30mu174" path="res://audio/conversione/mechanic_sound.wav" id="10_0dr47"]
[ext_resource type="AudioStream" uid="uid://7tw5efuo3gxj" path="res://audio/conversione/coin_to_coin.wav" id="11_ow0vy"]
[sub_resource type="SpriteFrames" id="SpriteFrames_1qp6y"]
animations = [{
"frames": [{
"duration": 1.0,
"texture": ExtResource("3_pscuu")
}, {
"duration": 1.0,
"texture": ExtResource("4_yq53c")
}, {
"duration": 1.0,
"texture": ExtResource("5_ycslk")
}, {
"duration": 1.0,
"texture": ExtResource("6_0qxp1")
}],
"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="SilverConverter" type="StaticBody2D" node_paths=PackedStringArray("sprite_front", "conversion_timer", "sound_working", "sound_complete", "spawner")]
scale = Vector2(3, 3)
script = ExtResource("1_chhfg")
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("2_rpdc3")
[node name="SpriteFront" type="AnimatedSprite2D" parent="."]
z_index = 2
texture_filter = 1
sprite_frames = SubResource("SpriteFrames_1qp6y")
frame = 3
frame_progress = 0.193836
[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("7_3046q")]
z_index = 2
collecting_types = Array[StringName]([&"Silver"])
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_65kmt")]
position = Vector2(0, 8)
scene = ExtResource("9_t8y3t")
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_0dr47")
[node name="SoundComplete" type="AudioStreamPlayer" parent="."]
stream = ExtResource("11_ow0vy")
[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"]

View file

@ -0,0 +1,39 @@
[gd_scene load_steps=7 format=3 uid="uid://du3005kwybbrh"]
[ext_resource type="PhysicsMaterial" uid="uid://c6kn1an85lccr" path="res://entity/coin_physics_material.tres" id="1_nfq5t"]
[ext_resource type="Texture2D" uid="uid://dxtstvjlten8p" path="res://entity/coin_gold/coin_gold.png" id="2_1mhvl"]
[ext_resource type="Texture2D" uid="uid://bwqsdmghnrmhy" path="res://entity/coin_gold/coin_gold_outline.png" id="3_v0ty1"]
[ext_resource type="PackedScene" uid="uid://bk1vvq5rug01m" path="res://collector/collectible.tscn" id="4_t2klm"]
[ext_resource type="PackedScene" uid="uid://ujpra0s1kpqi" path="res://value/valuable.tscn" id="5_palpv"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_c6byl"]
size = Vector2(27, 5)
[node name="CoinGold" type="RigidBody2D"]
collision_layer = 5
collision_mask = 7
mass = 2.0
inertia = 600.0
physics_material_override = ExtResource("1_nfq5t")
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"]
texture_filter = 1
texture = ExtResource("2_1mhvl")
[node name="Outline" type="Sprite2D" parent="CollisionShape2D"]
z_index = -1
texture_filter = 1
texture = ExtResource("3_v0ty1")
[node name="Collectible" parent="." instance=ExtResource("4_t2klm")]
type = &"Gold"
[node name="Valuable" parent="." instance=ExtResource("5_palpv")]
value = 100

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=10 format=3 uid="uid://c3rxmcwa5nqng"]
[gd_scene load_steps=11 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"]
@ -7,6 +7,7 @@
[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"]
[ext_resource type="PackedScene" uid="uid://but1bdslxp5jl" path="res://converters/silver_to_gold/silver_converter.tscn" id="8_0bbpi"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_4uksi"]
size = Vector2(80, 80)
@ -21,7 +22,7 @@ script = ExtResource("1_i3ly0")
[node name="Bottle" parent="." instance=ExtResource("1_y7o2l")]
[node name="TimeSpawner" parent="." node_paths=PackedStringArray("target") instance=ExtResource("3_qwsty")]
position = Vector2(136, 40)
position = Vector2(136, 0)
scene = ExtResource("4_5oayc")
target = NodePath("..")
buffer_cap = 1
@ -29,6 +30,7 @@ spawn_rect = Rect2(-20, 0, 40, 0)
overlapping_body_count_limit = 4
[node name="NeckShape" type="CollisionShape2D" parent="TimeSpawner"]
position = Vector2(0, 40)
shape = SubResource("RectangleShape2D_4uksi")
debug_color = Color(0, 0.6, 0.701961, 0)
@ -59,12 +61,20 @@ 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)
position = Vector2(63, 337)
[node name="Spawner" parent="CopperConverter" index="6" node_paths=PackedStringArray("target")]
target = NodePath("../..")
[node name="SilverConverter" parent="." instance=ExtResource("8_0bbpi")]
position = Vector2(136, 417)
rotation = -1.57079
[node name="Spawner" parent="SilverConverter" 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"]
[editable path="SilverConverter"]

View file

@ -28,16 +28,13 @@ script = ExtResource("3_xav0n")
[node name="GameWorld" type="CenterContainer" parent="CustomUI"]
custom_minimum_size = Vector2(270, 480)
layout_mode = 1
anchors_preset = 7
anchors_preset = 5
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
offset_bottom = 480.0
grow_horizontal = 2
grow_vertical = 0
[node name="GameViewport" type="SubViewportContainer" parent="CustomUI/GameWorld"]
layout_mode = 2