mirror of
https://github.com/Steffo99/swear-jar.git
synced 2024-11-27 18:04:19 +00:00
Fix more collision layer stuff
This commit is contained in:
parent
4e5ade9ddf
commit
63de9308a5
11 changed files with 24 additions and 10 deletions
|
@ -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="Texture2D" uid="uid://chc8wqc1pclbk" path="res://converters/gold_to_gem/gold_converter_back.png" id="2_hh4ft"]
|
||||
|
|
|
@ -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")]
|
||||
scale = Vector2(3, 3)
|
||||
collision_layer = 8
|
||||
collision_mask = 0
|
||||
script = ExtResource("1_qln0a")
|
||||
sprite_front = NodePath("SpriteFront")
|
||||
sprite_back = NodePath("SpriteBack")
|
||||
|
|
|
@ -38,7 +38,7 @@ radius = 1.5
|
|||
height = 28.0
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_31dtl"]
|
||||
size = Vector2(26, 11.1667)
|
||||
size = Vector2(26, 4)
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_k11if"]
|
||||
size = Vector2(26, 5)
|
||||
|
|
|
@ -13,7 +13,7 @@ size = Vector2(14, 3)
|
|||
|
||||
[node name="CoinCopper" type="RigidBody2D"]
|
||||
collision_layer = 4
|
||||
collision_mask = 6
|
||||
collision_mask = 14
|
||||
inertia = 1000.0
|
||||
physics_material_override = ExtResource("1_1fypc")
|
||||
continuous_cd = 1
|
||||
|
|
|
@ -11,7 +11,7 @@ size = Vector2(27, 5)
|
|||
|
||||
[node name="CoinGold" type="RigidBody2D"]
|
||||
collision_layer = 4
|
||||
collision_mask = 6
|
||||
collision_mask = 14
|
||||
mass = 2.0
|
||||
inertia = 600.0
|
||||
physics_material_override = ExtResource("1_nfq5t")
|
||||
|
|
|
@ -12,7 +12,7 @@ size = Vector2(21, 4)
|
|||
|
||||
[node name="CoinSilver" type="RigidBody2D"]
|
||||
collision_layer = 4
|
||||
collision_mask = 6
|
||||
collision_mask = 14
|
||||
mass = 1.5
|
||||
inertia = 800.0
|
||||
physics_material_override = ExtResource("1_4sq1a")
|
||||
|
|
|
@ -10,12 +10,12 @@
|
|||
[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 = 13.25
|
||||
height = 32.0
|
||||
radius = 4.0
|
||||
height = 10.0
|
||||
|
||||
[node name="Gem" type="RigidBody2D"]
|
||||
collision_layer = 4
|
||||
collision_mask = 6
|
||||
collision_mask = 14
|
||||
mass = 1.5
|
||||
inertia = 800.0
|
||||
physics_material_override = ExtResource("1_vmemd")
|
||||
|
|
|
@ -9,6 +9,7 @@ class_name Game
|
|||
@onready var store_collector_panel: Panel = $StoreCollector/Panel
|
||||
@onready var store_collector_texturerect: TextureRect = $StoreCollector/Panel/TextureRect
|
||||
@onready var store_collector_counter: Label = $StoreCollector/Panel/Label
|
||||
@onready var ghost: Ghost = $Ghost
|
||||
|
||||
|
||||
func trigger_spawn():
|
||||
|
@ -38,6 +39,8 @@ func _on_purchase_begin(what: PurchasableItem):
|
|||
update_counter_icon()
|
||||
update_counter_text()
|
||||
store_collector_panel.show()
|
||||
ghost.process_mode = Node.PROCESS_MODE_INHERIT
|
||||
ghost.show()
|
||||
|
||||
func _handle_purchase_success(what: PurchasableItem):
|
||||
what.complete_purchase()
|
||||
|
@ -47,12 +50,16 @@ func _on_purchase_cancel(what: PurchasableItem):
|
|||
store_collector.collecting_types = []
|
||||
store_collector.goal.disconnect(_handle_purchase_success)
|
||||
store_collector_panel.hide()
|
||||
ghost.process_mode = Node.PROCESS_MODE_DISABLED
|
||||
ghost.hide()
|
||||
|
||||
func _on_purchase_success(what: PurchasableItem):
|
||||
print("[Game] Succedeed purchase of ", what.name, " costing ", what.item_cost_goal, "x ", what.item_cost_type)
|
||||
store_collector.collecting_types = []
|
||||
store_collector.goal.disconnect(_handle_purchase_success)
|
||||
store_collector_panel.hide()
|
||||
ghost.process_mode = Node.PROCESS_MODE_DISABLED
|
||||
ghost.hide()
|
||||
|
||||
func _on_store_collector_collected(_body: RigidBody2D):
|
||||
update_counter_text()
|
||||
|
|
|
@ -42,7 +42,9 @@ upgrade_silver_texture = ExtResource("3_8wvr1")
|
|||
upgrade_gold_texture = ExtResource("4_i557v")
|
||||
|
||||
[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")
|
||||
scene_to_instantiate = ExtResource("7_ipeok")
|
||||
target = NodePath("..")
|
||||
|
|
|
@ -49,7 +49,8 @@ func _select_spawn_rotation() -> float:
|
|||
)
|
||||
|
||||
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
|
||||
var instantiated = scene.instantiate()
|
||||
instantiated.global_position = global_position + _select_spawn_position()
|
||||
|
|
|
@ -3,4 +3,6 @@
|
|||
[ext_resource type="Script" path="res://spawner/spawner.gd" id="1_xqfmg"]
|
||||
|
||||
[node name="Spawner" type="Area2D"]
|
||||
collision_layer = 0
|
||||
collision_mask = 4
|
||||
script = ExtResource("1_xqfmg")
|
||||
|
|
Loading…
Reference in a new issue