(wip) Player food

This commit is contained in:
Martin committed 2026-02-07 15:31:43 +01:00
1 parent 2352a3aa07
commit 232184afba
12 files changed
+104 -26

No files matched your search

@@ -1,6 +1,18 @@
extends AbstractFood
class_name FoodMolecular
func _on_body_entered(body: Node2D) -> void:
if body.has_method("collect_resource"): # TODO: Define a "consumer" group instead?
eat(body)
func eat(consumer: Node2D) -> void:
print("Player ate: ", food_name)
consumed.emit()
apply_effect(consumer)
queue_free()
func apply_effect(consumer: Node2D) -> void:
if consumer.has_method("collect_resource"):
consumer.collect_resource(val) # val is from parent (default 1), override if required
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.