mirror of
https://github.com/Steffo99/swear-jar.git
synced 2024-11-22 07:44:17 +00:00
gem
This commit is contained in:
parent
0bcb3327cd
commit
949afd3379
9 changed files with 196 additions and 62 deletions
133
converters/gold_to_gem/gem_converter.tscn
Normal file
133
converters/gold_to_gem/gem_converter.tscn
Normal file
|
@ -0,0 +1,133 @@
|
||||||
|
[gd_scene load_steps=21 format=3 uid="uid://c4ew8x4gch275"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" path="res://converters/converter.gd" id="1_f5plk"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://440yhlpwpfw4" path="res://converters/copper_to_silver/copper_converter_back.png" id="2_10qqc"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://dq5aowbt2wxec" path="res://converters/copper_to_silver/copper_converter_front_1.png" id="3_m7rs2"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://ck254fewe4l41" path="res://converters/copper_to_silver/copper_converter_front_2.png" id="4_aibvv"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://dg4qq1pgojk8d" path="res://converters/copper_to_silver/copper_converter_front_3.png" id="5_vqrfc"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://60502lbpup6" path="res://converters/copper_to_silver/copper_converter_front_4.png" id="6_r2hfj"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://c5w3b55aiui6c" path="res://collector/collector.tscn" id="7_m34js"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://c67lfbk4gf1ga" path="res://spawner/spawner.tscn" id="8_qwbjp"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://dme22vvfgme5f" path="res://entity/coin_silver/coin_silver.tscn" id="9_j1ned"]
|
||||||
|
[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"]
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_62dyi"]
|
||||||
|
atlas = ExtResource("3_m7rs2")
|
||||||
|
region = Rect2(0, 2, 32, 33)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_gs3wo"]
|
||||||
|
atlas = ExtResource("4_aibvv")
|
||||||
|
region = Rect2(0, 2, 32, 33)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_tboq2"]
|
||||||
|
atlas = ExtResource("5_vqrfc")
|
||||||
|
region = Rect2(0, 2, 32, 33)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_okgf4"]
|
||||||
|
atlas = ExtResource("6_r2hfj")
|
||||||
|
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="GemConverter" type="StaticBody2D"]
|
||||||
|
scale = Vector2(3, 3)
|
||||||
|
script = ExtResource("1_f5plk")
|
||||||
|
|
||||||
|
[node name="SpriteBack" type="Sprite2D" parent="."]
|
||||||
|
z_index = -2
|
||||||
|
texture_filter = 1
|
||||||
|
texture = ExtResource("2_10qqc")
|
||||||
|
|
||||||
|
[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="." instance=ExtResource("7_m34js")]
|
||||||
|
z_index = 2
|
||||||
|
collecting_types = Array[StringName]([&"Copper"])
|
||||||
|
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_qwbjp")]
|
||||||
|
position = Vector2(0, 8)
|
||||||
|
scene = ExtResource("9_j1ned")
|
||||||
|
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_f1h6i")
|
||||||
|
|
||||||
|
[node name="SoundWorking" type="AudioStreamPlayer" parent="."]
|
||||||
|
stream = ExtResource("10_f1h6i")
|
||||||
|
|
||||||
|
[node name="SoundComplete" type="AudioStreamPlayer" parent="."]
|
||||||
|
stream = ExtResource("11_ywwn2")
|
||||||
|
|
||||||
|
[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]
|
4
entity/gem/RandomValue.gd
Normal file
4
entity/gem/RandomValue.gd
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
extends Node
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
get_parent().value=Randomizer.rng.randi_range(0,360)
|
11
entity/gem/gem.gd
Normal file
11
entity/gem/gem.gd
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
extends RigidBody2D
|
||||||
|
|
||||||
|
|
||||||
|
# Called when the node enters the scene tree for the first time.
|
||||||
|
func _ready():
|
||||||
|
print($Valuable.value)
|
||||||
|
|
||||||
|
|
||||||
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||||
|
func _process(delta):
|
||||||
|
pass
|
46
entity/gem/gem.tscn
Normal file
46
entity/gem/gem.tscn
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
[gd_scene load_steps=9 format=3 uid="uid://w2er6cmul5yx"]
|
||||||
|
|
||||||
|
[ext_resource type="PhysicsMaterial" uid="uid://c6kn1an85lccr" path="res://entity/coin_physics_material.tres" id="1_vmemd"]
|
||||||
|
[ext_resource type="Script" path="res://entity/gem/gem.gd" id="2_0b343"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://b21bsbo5f0ed7" path="res://entity/gem/gemstone.png" id="3_6jejy"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://bk1vvq5rug01m" path="res://collector/collectible.tscn" id="4_idoeu"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://ujpra0s1kpqi" path="res://value/valuable.tscn" id="5_7bd6c"]
|
||||||
|
[ext_resource type="Script" path="res://entity/gem/RandomValue.gd" id="6_3lulr"]
|
||||||
|
[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
|
||||||
|
|
||||||
|
[node name="Gem" type="RigidBody2D"]
|
||||||
|
collision_layer = 5
|
||||||
|
collision_mask = 7
|
||||||
|
mass = 1.5
|
||||||
|
inertia = 800.0
|
||||||
|
physics_material_override = ExtResource("1_vmemd")
|
||||||
|
continuous_cd = 1
|
||||||
|
linear_damp = 0.1
|
||||||
|
angular_damp = 0.1
|
||||||
|
script = ExtResource("2_0b343")
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||||
|
scale = Vector2(2, 2)
|
||||||
|
shape = SubResource("CapsuleShape2D_jkfas")
|
||||||
|
|
||||||
|
[node name="Sprite" type="Sprite2D" parent="CollisionShape2D"]
|
||||||
|
texture_filter = 1
|
||||||
|
texture = ExtResource("3_6jejy")
|
||||||
|
|
||||||
|
[node name="Collectible" parent="." instance=ExtResource("4_idoeu")]
|
||||||
|
type = &"Silver"
|
||||||
|
|
||||||
|
[node name="Valuable" parent="." instance=ExtResource("5_7bd6c")]
|
||||||
|
value = 10
|
||||||
|
|
||||||
|
[node name="RandomValue" type="Node" parent="Valuable"]
|
||||||
|
script = ExtResource("6_3lulr")
|
||||||
|
|
||||||
|
[node name="SoundWorking" type="AudioStreamPlayer" parent="."]
|
||||||
|
stream = ExtResource("6_svrnw")
|
||||||
|
|
||||||
|
[connection signal="collected" from="Collectible" to="Collectible" method="_on_done" flags=18]
|
|
@ -1,15 +0,0 @@
|
||||||
extends RigidBody2D
|
|
||||||
|
|
||||||
|
|
||||||
# Called when the node enters the scene tree for the first time.
|
|
||||||
func _ready():
|
|
||||||
$CollisionShape2D/Sprite.set_material($CollisionShape2D/Sprite.get_material().duplicate(true))
|
|
||||||
|
|
||||||
|
|
||||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
|
||||||
func _process(delta):
|
|
||||||
var rand_hue = float(randi() % 3)/2.0/3.2
|
|
||||||
#$CollisionShape2D/Sprite.material.set_shader_param("Shift_Hue", rand_hue)
|
|
||||||
#print($CollisionShape2D/Sprite.modulate)
|
|
||||||
#CollisionShape2D/Sprite.modulate = Color.from_ok_hsl(0.5,0,0.9)
|
|
||||||
|
|
|
@ -1,44 +0,0 @@
|
||||||
[gd_scene load_steps=9 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="Script" path="res://entity/gem/gemstone.gd" id="2_4sf3r"]
|
|
||||||
[ext_resource type="Texture2D" uid="uid://b21bsbo5f0ed7" path="res://entity/gem/gemstone.png" id="2_gmg5g"]
|
|
||||||
[ext_resource type="Shader" path="res://entity/gem/gemstone.gdshader" id="3_v0fk6"]
|
|
||||||
[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
|
|
||||||
|
|
||||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_sakte"]
|
|
||||||
shader = ExtResource("3_v0fk6")
|
|
||||||
shader_parameter/Shift_Hue = null
|
|
||||||
|
|
||||||
[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
|
|
||||||
script = ExtResource("2_4sf3r")
|
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
|
||||||
scale = Vector2(2, 2)
|
|
||||||
shape = SubResource("CapsuleShape2D_130vq")
|
|
||||||
|
|
||||||
[node name="Sprite" type="Sprite2D" parent="CollisionShape2D"]
|
|
||||||
texture_filter = 1
|
|
||||||
material = SubResource("ShaderMaterial_sakte")
|
|
||||||
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"]
|
|
|
@ -8,8 +8,8 @@
|
||||||
[ext_resource type="PackedScene" uid="uid://c3kitncwpi42j" path="res://entity/coin_copper/coin_copper.tscn" id="4_5oayc"]
|
[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="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://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://ratkps4plkhl" path="res://converters/copper_to_silver/copper_converter.tscn" id="7_ipeok"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://w2er6cmul5yx" path="res://entity/gem/gem.tscn" id="7_u1xgy"]
|
||||||
[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" 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"]
|
||||||
|
@ -42,7 +42,7 @@ upgrade_gold_texture = ExtResource("4_i557v")
|
||||||
|
|
||||||
[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("7_13ofu")
|
scene = ExtResource("7_u1xgy")
|
||||||
target = NodePath("..")
|
target = NodePath("..")
|
||||||
buffer_cap = 1
|
buffer_cap = 1
|
||||||
spawn_rect = Rect2(-20, 0, 40, 0)
|
spawn_rect = Rect2(-20, 0, 40, 0)
|
||||||
|
|
|
@ -54,7 +54,6 @@ func _do_spawn():
|
||||||
if len(get_overlapping_bodies()) > overlapping_body_count_limit:
|
if len(get_overlapping_bodies()) > overlapping_body_count_limit:
|
||||||
return
|
return
|
||||||
var instantiated = scene.instantiate()
|
var instantiated = scene.instantiate()
|
||||||
instantiated.
|
|
||||||
instantiated.global_position = global_position + _select_spawn_position()
|
instantiated.global_position = global_position + _select_spawn_position()
|
||||||
instantiated.rotation_degrees = _select_spawn_rotation()
|
instantiated.rotation_degrees = _select_spawn_rotation()
|
||||||
target.add_child(instantiated)
|
target.add_child(instantiated)
|
||||||
|
|
Loading…
Reference in a new issue