1
Fork 0
mirror of https://github.com/Steffo99/hella-farm.git synced 2024-11-21 23:54:23 +00:00

idk something is broken

This commit is contained in:
Steffo 2024-04-30 06:00:53 +02:00
parent dfb6b96041
commit acf96de7fc
Signed by: steffo
GPG key ID: 5ADA3868646C3FC0
14 changed files with 35 additions and 15 deletions

View file

@ -30,14 +30,15 @@ func disable():
func spawn(): func spawn():
if not enabled: if not enabled:
spawn_blocked.emit() spawn_blocked.emit()
return return null
if not target: if not target:
target = MainGame.get_via_group(self).default_spawn_parent target = MainGame.get_via_group(self).default_spawn_parent
if not target: if not target:
target = self target = self
if not scene: if not scene:
Log.w(self, "Not spawning, no scene is set.") Log.w(self, "Not spawning, no scene is set.")
return return null
var entity = scene.instantiate() var entity = scene.instantiate()
entity.global_position = global_position entity.global_position = global_position
target.add_child.call_deferred(entity) # Not sure why this is needed. target.add_child.call_deferred(entity) # Not sure why this is needed.
return entity

View file

@ -365,7 +365,7 @@ radius = 32.0
[node name="Chupacabra" type="CharacterBody2D"] [node name="Chupacabra" type="CharacterBody2D"]
y_sort_enabled = true y_sort_enabled = true
collision_layer = 8 collision_layer = 72
collision_mask = 14 collision_mask = 14
motion_mode = 1 motion_mode = 1
script = ExtResource("1_s4qg1") script = ExtResource("1_s4qg1")

View file

@ -194,7 +194,7 @@ radius = 50.0
[node name="Cthulhu" type="CharacterBody2D"] [node name="Cthulhu" type="CharacterBody2D"]
y_sort_enabled = true y_sort_enabled = true
collision_layer = 8 collision_layer = 72
collision_mask = 14 collision_mask = 14
script = ExtResource("1_b55wc") script = ExtResource("1_b55wc")

View file

@ -28,12 +28,14 @@ scale = Vector2(2, 2)
texture = ExtResource("2_tt3v6") texture = ExtResource("2_tt3v6")
[node name="MagnetizeArea" parent="." instance=ExtResource("3_ne3sj")] [node name="MagnetizeArea" parent="." instance=ExtResource("3_ne3sj")]
collision_mask = 128
[node name="Shape" type="CollisionShape2D" parent="MagnetizeArea"] [node name="Shape" type="CollisionShape2D" parent="MagnetizeArea"]
shape = SubResource("CircleShape2D_w1h35") shape = SubResource("CircleShape2D_w1h35")
debug_color = Color(0.337255, 0.611765, 1, 0) debug_color = Color(0.337255, 0.611765, 1, 0)
[node name="CollectArea" parent="." instance=ExtResource("3_ne3sj")] [node name="CollectArea" parent="." instance=ExtResource("3_ne3sj")]
collision_mask = 128
[node name="Shape" type="CollisionShape2D" parent="CollectArea"] [node name="Shape" type="CollisionShape2D" parent="CollectArea"]
shape = SubResource("CircleShape2D_jm7yp") shape = SubResource("CircleShape2D_jm7yp")

View file

@ -233,7 +233,7 @@ radius = 40.0
[node name="Imp" type="CharacterBody2D"] [node name="Imp" type="CharacterBody2D"]
y_sort_enabled = true y_sort_enabled = true
collision_layer = 8 collision_layer = 72
collision_mask = 14 collision_mask = 14
motion_mode = 1 motion_mode = 1
script = ExtResource("1_dixpc") script = ExtResource("1_dixpc")

View file

@ -107,7 +107,7 @@ radius = 12.0
[node name="Monocle" type="CharacterBody2D"] [node name="Monocle" type="CharacterBody2D"]
y_sort_enabled = true y_sort_enabled = true
collision_layer = 8 collision_layer = 72
collision_mask = 14 collision_mask = 14
motion_mode = 1 motion_mode = 1
script = ExtResource("1_ehpfj") script = ExtResource("1_ehpfj")

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=6 format=3 uid="uid://ddpo03rb6068c"] [gd_scene load_steps=7 format=3 uid="uid://ddpo03rb6068c"]
[ext_resource type="Script" path="res://entities/sacrifice_stone.gd" id="1_sgl1t"] [ext_resource type="Script" path="res://entities/sacrifice_stone.gd" id="1_sgl1t"]
[ext_resource type="PackedScene" uid="uid://dfdr3e32lohq" path="res://behaviours/edible.tscn" id="1_y58y4"] [ext_resource type="PackedScene" uid="uid://dfdr3e32lohq" path="res://behaviours/edible.tscn" id="1_y58y4"]
@ -8,6 +8,9 @@
[sub_resource type="CircleShape2D" id="CircleShape2D_yv6hf"] [sub_resource type="CircleShape2D" id="CircleShape2D_yv6hf"]
radius = 8.0 radius = 8.0
[sub_resource type="RectangleShape2D" id="RectangleShape2D_55alx"]
size = Vector2(150, 150)
[node name="SacrificeStone" type="Node2D"] [node name="SacrificeStone" type="Node2D"]
y_sort_enabled = true y_sort_enabled = true
script = ExtResource("1_sgl1t") script = ExtResource("1_sgl1t")
@ -41,5 +44,15 @@ shape = SubResource("CircleShape2D_yv6hf")
one_way_collision_margin = 27.5 one_way_collision_margin = 27.5
debug_color = Color(1, 0, 0, 0) debug_color = Color(1, 0, 0, 0)
[node name="ForbidSpawn" type="Area2D" parent="."]
position = Vector2(0, -29)
collision_layer = 64
collision_mask = 0
monitoring = false
[node name="Shape" type="CollisionShape2D" parent="ForbidSpawn"]
shape = SubResource("RectangleShape2D_55alx")
debug_color = Color(0.733333, 0.447059, 0.411765, 0.419608)
[connection signal="tracked" from="StoneArea/SacrificeTracker" to="." method="_on_tracked"] [connection signal="tracked" from="StoneArea/SacrificeTracker" to="." method="_on_tracked"]
[connection signal="untracked" from="StoneArea/SacrificeTracker" to="." method="_on_untracked"] [connection signal="untracked" from="StoneArea/SacrificeTracker" to="." method="_on_untracked"]

View file

@ -210,7 +210,7 @@ radius = 8.65
[node name="Sheep" type="CharacterBody2D"] [node name="Sheep" type="CharacterBody2D"]
z_index = 1 z_index = 1
y_sort_enabled = true y_sort_enabled = true
collision_layer = 8 collision_layer = 72
collision_mask = 14 collision_mask = 14
motion_mode = 1 motion_mode = 1
script = ExtResource("1_4dmll") script = ExtResource("1_4dmll")

View file

@ -115,7 +115,7 @@ radius = 32.0
[node name="Skull" type="CharacterBody2D"] [node name="Skull" type="CharacterBody2D"]
y_sort_enabled = true y_sort_enabled = true
collision_layer = 8 collision_layer = 72
collision_mask = 14 collision_mask = 14
motion_mode = 1 motion_mode = 1
script = ExtResource("1_7g8bu") script = ExtResource("1_7g8bu")

View file

@ -106,7 +106,7 @@ radius = 12.0
[node name="TopHat" type="CharacterBody2D"] [node name="TopHat" type="CharacterBody2D"]
y_sort_enabled = true y_sort_enabled = true
collision_layer = 8 collision_layer = 72
collision_mask = 14 collision_mask = 14
motion_mode = 1 motion_mode = 1
script = ExtResource("1_0eh11") script = ExtResource("1_0eh11")

View file

@ -16,7 +16,7 @@ scale = Vector2(2, 2)
texture = ExtResource("1_yk0t0") texture = ExtResource("1_yk0t0")
[node name="Upper" type="StaticBody2D" parent="."] [node name="Upper" type="StaticBody2D" parent="."]
collision_layer = 16 collision_layer = 80
collision_mask = 0 collision_mask = 0
[node name="Shape" type="CollisionShape2D" parent="Upper"] [node name="Shape" type="CollisionShape2D" parent="Upper"]

View file

@ -192,7 +192,7 @@ radius = 40.0
[node name="Watcher" type="CharacterBody2D"] [node name="Watcher" type="CharacterBody2D"]
z_index = 10 z_index = 10
collision_layer = 16 collision_layer = 80
collision_mask = 18 collision_mask = 18
script = ExtResource("1_brahc") script = ExtResource("1_brahc")

View file

@ -69,8 +69,8 @@ func _input(event: InputEvent) -> void:
if event.pressed: if event.pressed:
var counter: Counter = game.inventory.get_counter(&"Gold") var counter: Counter = game.inventory.get_counter(&"Gold")
if counter.value >= sheep_spawn_cost: if counter.value >= sheep_spawn_cost:
counter.decrease(sheep_spawn_cost) if sheep_spawner.spawn():
sheep_spawner.spawn() counter.decrease(sheep_spawn_cost)
func _physics_process(_delta: float) -> void: func _physics_process(_delta: float) -> void:

View file

@ -14,7 +14,7 @@ radius = 8.0
[node name="Cursor" type="Area2D" groups=["cursor"]] [node name="Cursor" type="Area2D" groups=["cursor"]]
z_index = 100 z_index = 100
collision_layer = 64 collision_layer = 128
collision_mask = 56 collision_mask = 56
script = ExtResource("1_1og6v") script = ExtResource("1_1og6v")
@ -31,9 +31,13 @@ script = ExtResource("3_tutfd")
scene = ExtResource("4_7isfg") scene = ExtResource("4_7isfg")
[node name="Tracker" parent="SheepSpawner" instance=ExtResource("5_ewy4o")] [node name="Tracker" parent="SheepSpawner" instance=ExtResource("5_ewy4o")]
collision_mask = 64
[node name="Shape" type="CollisionShape2D" parent="SheepSpawner/Tracker"] [node name="Shape" type="CollisionShape2D" parent="SheepSpawner/Tracker"]
shape = SubResource("CircleShape2D_dc2ul") shape = SubResource("CircleShape2D_dc2ul")
[connection signal="area_entered" from="SheepSpawner/Tracker" to="SheepSpawner/Tracker" method="track"]
[connection signal="area_exited" from="SheepSpawner/Tracker" to="SheepSpawner/Tracker" method="untrack"]
[connection signal="empty" from="SheepSpawner/Tracker" to="SheepSpawner" method="enable"] [connection signal="empty" from="SheepSpawner/Tracker" to="SheepSpawner" method="enable"]
[connection signal="tracked" from="SheepSpawner/Tracker" to="SheepSpawner/Tracker" method="log_tracked"]
[connection signal="tracked" from="SheepSpawner/Tracker" to="SheepSpawner" method="disable" unbinds=1] [connection signal="tracked" from="SheepSpawner/Tracker" to="SheepSpawner" method="disable" unbinds=1]