Hi guys! I have the next situation:
I have 5 enemies, and for economic purposes I unied them into the family "enemies" and it works good.
But if I have more than 1 instance, I found that they act as a whole (for example I have fight with object wolf in the family, and object bear does all what wolf does (takes damage, etc).
How can I do that they will act separately what was written for the family? I saw pick section in system, but don't understand how to use it in my situation
Develop games in your browser. Powerful, performant & highly capable.
Assign a variable to the instances with unique values and then act upon that variable .
You could use my tutorial on instance variables here
I mean if I use method on screen it works how I want and when I place enemies on the layout, if they see a hero they act as a separate object, not as a whole. But the question is, is it efficient for optimisation or it is not quite good?
Assuming the enemies don't move if x=X, then this is OK. You don't need to set the speed constantly since it doesn't change between the two cases.