How do I make a value between objects?

Godot Version

4

Question

`I’m making enemies drop specific items and when they drop an item no other enemies can drop that same item, I understand how to make this work with one enemy by changing that items value to false, so I want to know how to change all of the values to false. But if I sent signals to all the other enemies from the enemy who dropped it new enemies would spawn in with it that items value set to true so how to I make something like a shared value that changes whenever anything affects it for everyone?

You can create static values that are shared between all instances of a class. Assuming the enemies share a base class, you could put it there.

https://docs.godotengine.org/en/stable/tutorials/scripting/gdscript/gdscript_basics.html#static-variables

1 Like

I have this gun rotating towards enemies I used the drop and drop while holding ctrl to get the enemy for it to follow but it only follows that one enemy of course, can using these static values and classes make it target any enemy under that class and what do you reamend I do to make sure it only target the closest enemy

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.