Actor attributes in Gamesalad

Is there a way to make a global attribute for an actor? I need this because I'm making a distance from behavior but the actor it checks against will change. Does anyone know how to achieve this?
Best Answer
-
FloridaGames Posts: 328
so for your problem make two game attributes: actor x, and actor y. In the actor add two constrain attribute behaviors: "constrain attribute game.actor x to self.position x" and an identical one substituting "x" with "y".
EDIT: looks like Photics beat me to it...
Answers
Game -> Scene -> Actor
If you want one actor to read the attributes of another actor, then transfer that data to a Scene or Game attribute. If you want a global attribute for an actor... you don't have to use actor attributes. You can use game attributes to store data.
As an example, I usually make Player health a game attribute, as so many other actors may interact with it.
The problem is when you have multiple copies of the same actor. They'll try to overwrite the game attribute with their own. Example... two enemy actors can't share the same Game attribute for their health, or they'll run out of health at the same time.