From 8f053b51ee94ab3c70a36b65e6d1c2a02bb7e695 Mon Sep 17 00:00:00 2001 From: Matteo Balugani Date: Mon, 2 Oct 2023 11:21:27 +0200 Subject: [PATCH] created simple gemstone --- entity/coin_silver/coin_silver.tscn | 6 ++++- entity/gem/gemstone.tscn | 36 +++++++++++++++++++++++++++++ game/game.tscn | 8 ++++--- 3 files changed, 46 insertions(+), 4 deletions(-) create mode 100644 entity/gem/gemstone.tscn diff --git a/entity/coin_silver/coin_silver.tscn b/entity/coin_silver/coin_silver.tscn index 86b4b9d..8141872 100644 --- a/entity/coin_silver/coin_silver.tscn +++ b/entity/coin_silver/coin_silver.tscn @@ -1,10 +1,11 @@ -[gd_scene load_steps=7 format=3 uid="uid://dme22vvfgme5f"] +[gd_scene load_steps=8 format=3 uid="uid://dme22vvfgme5f"] [ext_resource type="PhysicsMaterial" uid="uid://c6kn1an85lccr" path="res://entity/coin_physics_material.tres" id="1_4sq1a"] [ext_resource type="Texture2D" uid="uid://m5t74cw8ht5b" path="res://entity/coin_silver/coin_silver_2.png" id="2_0u0up"] [ext_resource type="Texture2D" uid="uid://beikajpd08pwr" path="res://entity/coin_silver/coin_silver_outline_2.png" id="3_nxu2p"] [ext_resource type="PackedScene" uid="uid://bk1vvq5rug01m" path="res://collector/collectible.tscn" id="4_12sii"] [ext_resource type="PackedScene" uid="uid://ujpra0s1kpqi" path="res://value/valuable.tscn" id="5_u3bvw"] +[ext_resource type="AudioStream" uid="uid://br25ip30mu174" path="res://audio/conversione/mechanic_sound.wav" id="6_tmdfg"] [sub_resource type="RectangleShape2D" id="RectangleShape2D_c6byl"] size = Vector2(21, 4) @@ -38,4 +39,7 @@ type = &"Silver" [node name="Valuable" parent="." instance=ExtResource("5_u3bvw")] value = 10 +[node name="SoundWorking" type="AudioStreamPlayer" parent="."] +stream = ExtResource("6_tmdfg") + [connection signal="collected" from="Collectible" to="Collectible" method="_on_done"] diff --git a/entity/gem/gemstone.tscn b/entity/gem/gemstone.tscn new file mode 100644 index 0000000..b11d0af --- /dev/null +++ b/entity/gem/gemstone.tscn @@ -0,0 +1,36 @@ +[gd_scene load_steps=6 format=3 uid="uid://6pp1pebasum3"] + +[ext_resource type="PhysicsMaterial" uid="uid://c6kn1an85lccr" path="res://entity/coin_physics_material.tres" id="1_1d567"] +[ext_resource type="Texture2D" uid="uid://b21bsbo5f0ed7" path="res://entity/gem/gemstone.png" id="2_gmg5g"] +[ext_resource type="PackedScene" uid="uid://bk1vvq5rug01m" path="res://collector/collectible.tscn" id="4_01x0a"] +[ext_resource type="PackedScene" uid="uid://ujpra0s1kpqi" path="res://value/valuable.tscn" id="5_wdbjk"] + +[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_130vq"] +radius = 4.0 +height = 10.0 + +[node name="Gemstone" type="RigidBody2D"] +collision_layer = 5 +collision_mask = 7 +mass = 1.5 +inertia = 800.0 +physics_material_override = ExtResource("1_1d567") +continuous_cd = 1 +linear_damp = 0.1 +angular_damp = 0.1 + +[node name="CollisionShape2D" type="CollisionShape2D" parent="."] +scale = Vector2(2, 2) +shape = SubResource("CapsuleShape2D_130vq") + +[node name="Sprite" type="Sprite2D" parent="CollisionShape2D"] +texture_filter = 1 +texture = ExtResource("2_gmg5g") + +[node name="Collectible" parent="." instance=ExtResource("4_01x0a")] +type = &"Gem" + +[node name="Valuable" parent="." instance=ExtResource("5_wdbjk")] +value = 10 + +[connection signal="collected" from="Collectible" to="Collectible" method="_on_done"] diff --git a/game/game.tscn b/game/game.tscn index 32348b2..2e6bfef 100644 --- a/game/game.tscn +++ b/game/game.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=20 format=3 uid="uid://c3rxmcwa5nqng"] +[gd_scene load_steps=21 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"] @@ -8,6 +8,7 @@ [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://6pp1pebasum3" path="res://entity/gem/gemstone.tscn" id="7_13ofu"] [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://c2rlx7egl7xiv" path="res://collector/universal_collector.tscn" id="9_7op48"] @@ -41,7 +42,7 @@ upgrade_gold_texture = ExtResource("4_i557v") [node name="TimeSpawner" parent="." node_paths=PackedStringArray("target") instance=ExtResource("3_qwsty")] position = Vector2(136, 0) -scene = ExtResource("4_5oayc") +scene = ExtResource("7_13ofu") target = NodePath("..") buffer_cap = 1 spawn_rect = Rect2(-20, 0, 40, 0) @@ -53,6 +54,7 @@ shape = SubResource("RectangleShape2D_4uksi") debug_color = Color(0, 0.6, 0.701961, 0) [node name="Timer" type="Timer" parent="TimeSpawner"] +autostart = true [node name="ButtonSpawner" parent="." node_paths=PackedStringArray("target") instance=ExtResource("3_qwsty")] position = Vector2(136, 0) @@ -77,7 +79,7 @@ shape = SubResource("RectangleShape2D_rh35r") debug_color = Color(0, 0.6, 0.701961, 0) [node name="CopperConverter" parent="." instance=ExtResource("7_ipeok")] -position = Vector2(136, 165) +position = Vector2(62, 176) metadata/_edit_group_ = true [node name="Spawner" parent="CopperConverter" index="6" node_paths=PackedStringArray("target")]