1
Fork 0
mirror of https://github.com/Steffo99/swear-jar.git synced 2024-11-24 08:34:19 +00:00

Fix more collision layer stuff

This commit is contained in:
Steffo 2023-10-02 18:36:55 +02:00
parent 4e5ade9ddf
commit 63de9308a5
Signed by: steffo
GPG key ID: 2A24051445686895
11 changed files with 24 additions and 10 deletions

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=24 format=3 uid="uid://cqshgmptdav2b"] [gd_scene load_steps=24 format=3 uid="uid://cb1t7ylnkmt3t"]
[ext_resource type="Script" path="res://converters/converter.gd" id="1_fgju3"] [ext_resource type="Script" path="res://converters/converter.gd" id="1_fgju3"]
[ext_resource type="Texture2D" uid="uid://chc8wqc1pclbk" path="res://converters/gold_to_gem/gold_converter_back.png" id="2_hh4ft"] [ext_resource type="Texture2D" uid="uid://chc8wqc1pclbk" path="res://converters/gold_to_gem/gold_converter_back.png" id="2_hh4ft"]

View file

@ -144,6 +144,8 @@ 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" node_paths=PackedStringArray("sprite_front", "sprite_back", "conversion_timer", "sound_working", "sound_complete", "spawner")]
scale = Vector2(3, 3) scale = Vector2(3, 3)
collision_layer = 8
collision_mask = 0
script = ExtResource("1_qln0a") script = ExtResource("1_qln0a")
sprite_front = NodePath("SpriteFront") sprite_front = NodePath("SpriteFront")
sprite_back = NodePath("SpriteBack") sprite_back = NodePath("SpriteBack")

View file

@ -38,7 +38,7 @@ radius = 1.5
height = 28.0 height = 28.0
[sub_resource type="RectangleShape2D" id="RectangleShape2D_31dtl"] [sub_resource type="RectangleShape2D" id="RectangleShape2D_31dtl"]
size = Vector2(26, 11.1667) 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)

View file

@ -13,7 +13,7 @@ size = Vector2(14, 3)
[node name="CoinCopper" type="RigidBody2D"] [node name="CoinCopper" type="RigidBody2D"]
collision_layer = 4 collision_layer = 4
collision_mask = 6 collision_mask = 14
inertia = 1000.0 inertia = 1000.0
physics_material_override = ExtResource("1_1fypc") physics_material_override = ExtResource("1_1fypc")
continuous_cd = 1 continuous_cd = 1

View file

@ -11,7 +11,7 @@ size = Vector2(27, 5)
[node name="CoinGold" type="RigidBody2D"] [node name="CoinGold" type="RigidBody2D"]
collision_layer = 4 collision_layer = 4
collision_mask = 6 collision_mask = 14
mass = 2.0 mass = 2.0
inertia = 600.0 inertia = 600.0
physics_material_override = ExtResource("1_nfq5t") physics_material_override = ExtResource("1_nfq5t")

View file

@ -12,7 +12,7 @@ size = Vector2(21, 4)
[node name="CoinSilver" type="RigidBody2D"] [node name="CoinSilver" type="RigidBody2D"]
collision_layer = 4 collision_layer = 4
collision_mask = 6 collision_mask = 14
mass = 1.5 mass = 1.5
inertia = 800.0 inertia = 800.0
physics_material_override = ExtResource("1_4sq1a") physics_material_override = ExtResource("1_4sq1a")

View file

@ -10,12 +10,12 @@
[ext_resource type="AudioStream" uid="uid://br25ip30mu174" path="res://audio/conversione/mechanic_sound.wav" id="6_svrnw"] [ext_resource type="AudioStream" uid="uid://br25ip30mu174" path="res://audio/conversione/mechanic_sound.wav" id="6_svrnw"]
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_jkfas"] [sub_resource type="CapsuleShape2D" id="CapsuleShape2D_jkfas"]
radius = 13.25 radius = 4.0
height = 32.0 height = 10.0
[node name="Gem" type="RigidBody2D"] [node name="Gem" type="RigidBody2D"]
collision_layer = 4 collision_layer = 4
collision_mask = 6 collision_mask = 14
mass = 1.5 mass = 1.5
inertia = 800.0 inertia = 800.0
physics_material_override = ExtResource("1_vmemd") physics_material_override = ExtResource("1_vmemd")

View file

@ -9,6 +9,7 @@ class_name Game
@onready var store_collector_panel: Panel = $StoreCollector/Panel @onready var store_collector_panel: Panel = $StoreCollector/Panel
@onready var store_collector_texturerect: TextureRect = $StoreCollector/Panel/TextureRect @onready var store_collector_texturerect: TextureRect = $StoreCollector/Panel/TextureRect
@onready var store_collector_counter: Label = $StoreCollector/Panel/Label @onready var store_collector_counter: Label = $StoreCollector/Panel/Label
@onready var ghost: Ghost = $Ghost
func trigger_spawn(): func trigger_spawn():
@ -38,6 +39,8 @@ func _on_purchase_begin(what: PurchasableItem):
update_counter_icon() update_counter_icon()
update_counter_text() update_counter_text()
store_collector_panel.show() store_collector_panel.show()
ghost.process_mode = Node.PROCESS_MODE_INHERIT
ghost.show()
func _handle_purchase_success(what: PurchasableItem): func _handle_purchase_success(what: PurchasableItem):
what.complete_purchase() what.complete_purchase()
@ -47,12 +50,16 @@ func _on_purchase_cancel(what: PurchasableItem):
store_collector.collecting_types = [] store_collector.collecting_types = []
store_collector.goal.disconnect(_handle_purchase_success) store_collector.goal.disconnect(_handle_purchase_success)
store_collector_panel.hide() store_collector_panel.hide()
ghost.process_mode = Node.PROCESS_MODE_DISABLED
ghost.hide()
func _on_purchase_success(what: PurchasableItem): func _on_purchase_success(what: PurchasableItem):
print("[Game] Succedeed purchase of ", what.name, " costing ", what.item_cost_goal, "x ", what.item_cost_type) print("[Game] Succedeed purchase of ", what.name, " costing ", what.item_cost_goal, "x ", what.item_cost_type)
store_collector.collecting_types = [] store_collector.collecting_types = []
store_collector.goal.disconnect(_handle_purchase_success) store_collector.goal.disconnect(_handle_purchase_success)
store_collector_panel.hide() store_collector_panel.hide()
ghost.process_mode = Node.PROCESS_MODE_DISABLED
ghost.hide()
func _on_store_collector_collected(_body: RigidBody2D): func _on_store_collector_collected(_body: RigidBody2D):
update_counter_text() update_counter_text()

View file

@ -42,7 +42,9 @@ upgrade_silver_texture = ExtResource("3_8wvr1")
upgrade_gold_texture = ExtResource("4_i557v") upgrade_gold_texture = ExtResource("4_i557v")
[node name="Ghost" parent="." node_paths=PackedStringArray("target") instance=ExtResource("16_8vhx6")] [node name="Ghost" parent="." node_paths=PackedStringArray("target") instance=ExtResource("16_8vhx6")]
position = Vector2(90, 306) process_mode = 4
visible = false
position = Vector2(135, 360)
preview_texture = ExtResource("6_0jj8g") preview_texture = ExtResource("6_0jj8g")
scene_to_instantiate = ExtResource("7_ipeok") scene_to_instantiate = ExtResource("7_ipeok")
target = NodePath("..") target = NodePath("..")

View file

@ -49,7 +49,8 @@ func _select_spawn_rotation() -> float:
) )
func _do_spawn(): func _do_spawn():
if len(get_overlapping_bodies()) > overlapping_body_count_limit: var overlapping_bodies = get_overlapping_bodies()
if len(overlapping_bodies) > overlapping_body_count_limit:
return return
var instantiated = scene.instantiate() var instantiated = scene.instantiate()
instantiated.global_position = global_position + _select_spawn_position() instantiated.global_position = global_position + _select_spawn_position()

View file

@ -3,4 +3,6 @@
[ext_resource type="Script" path="res://spawner/spawner.gd" id="1_xqfmg"] [ext_resource type="Script" path="res://spawner/spawner.gd" id="1_xqfmg"]
[node name="Spawner" type="Area2D"] [node name="Spawner" type="Area2D"]
collision_layer = 0
collision_mask = 4
script = ExtResource("1_xqfmg") script = ExtResource("1_xqfmg")