(wip) Food spawning on prey death
This commit is contained in:
@@ -47,4 +47,3 @@ func _on_entity_consumed() -> void:
|
|||||||
_currentCount = max(0, _currentCount-1)
|
_currentCount = max(0, _currentCount-1)
|
||||||
call_deferred("_spawn_minimum")
|
call_deferred("_spawn_minimum")
|
||||||
|
|
||||||
# TODO: Spawn food when an entity (any) dies
|
|
||||||
|
|||||||
@@ -127,6 +127,6 @@ metadata/_custom_type_script = "uid://coetidfssb80w"
|
|||||||
|
|
||||||
[node name="FoodManager" type="Node" parent="." unique_id=449460585]
|
[node name="FoodManager" type="Node" parent="." unique_id=449460585]
|
||||||
script = ExtResource("8_mys4o")
|
script = ExtResource("8_mys4o")
|
||||||
foodTypes = [ExtResource("9_ojt85")]
|
foodTypes = Array[PackedScene]([ExtResource("9_ojt85")])
|
||||||
foodProbs = Array[float]([1.0])
|
foodProbs = Array[float]([1.0])
|
||||||
metadata/_custom_type_script = "uid://7ua0qgyhphao"
|
metadata/_custom_type_script = "uid://7ua0qgyhphao"
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ func handle_damage(dmg: int, src: Node) -> void:
|
|||||||
func die() -> void:
|
func die() -> void:
|
||||||
sprite.play("Dying")
|
sprite.play("Dying")
|
||||||
wrapper.play_sprite("Dying")
|
wrapper.play_sprite("Dying")
|
||||||
|
GameManager.foodManager._spawn_food(position)
|
||||||
super.die()
|
super.die()
|
||||||
|
|
||||||
func become_injured() -> void:
|
func become_injured() -> void:
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ func _spawn_creature(position: Vector2) -> void:
|
|||||||
instance.position = position
|
instance.position = position
|
||||||
add_child(instance)
|
add_child(instance)
|
||||||
if instance.has_signal("died"):
|
if instance.has_signal("died"):
|
||||||
|
#instance.died.connect(GameManager.foodManager._spawn_food_on_position)
|
||||||
instance.died.connect(_on_entity_died)
|
instance.died.connect(_on_entity_died)
|
||||||
|
|
||||||
func _on_entity_died() -> void:
|
func _on_entity_died() -> void:
|
||||||
|
|||||||
Reference in New Issue
Block a user