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:
parent
dfb6b96041
commit
acf96de7fc
14 changed files with 35 additions and 15 deletions
|
@ -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
|
||||||
|
|
|
@ -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")
|
||||||
|
|
|
@ -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")
|
||||||
|
|
||||||
|
|
|
@ -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")
|
||||||
|
|
|
@ -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")
|
||||||
|
|
|
@ -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")
|
||||||
|
|
|
@ -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"]
|
||||||
|
|
|
@ -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")
|
||||||
|
|
|
@ -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")
|
||||||
|
|
|
@ -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")
|
||||||
|
|
|
@ -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"]
|
||||||
|
|
|
@ -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")
|
||||||
|
|
||||||
|
|
|
@ -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:
|
||||||
|
if sheep_spawner.spawn():
|
||||||
counter.decrease(sheep_spawn_cost)
|
counter.decrease(sheep_spawn_cost)
|
||||||
sheep_spawner.spawn()
|
|
||||||
|
|
||||||
|
|
||||||
func _physics_process(_delta: float) -> void:
|
func _physics_process(_delta: float) -> void:
|
||||||
|
|
|
@ -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]
|
||||||
|
|
Loading…
Reference in a new issue