Passing Actor position data to expression editor
Hi
I adapting this patch emulating chemotaxis, and the basic principle is actor 1 chases the mouse around the screen. Say for instance I wanted to use a different actors position data, one on a random path, I can't seem to work out how to send the position data or use another actors attributes. Am I approaching this the wrong way?
Here is the file: http://www.mediafire.com/download.php?7jp43yvo3auxq8e
For background on chemotaxis, see: http://www.mit.edu/~kardar/teaching/projects/chemotaxis(AndreaSchmidt)/index.htm
This is how it is:
magnitude( game.Mouse.Position.X - self.Position.X, game.Mouse.Position.Y- self.Position.Y)
this is how I would like it to be:
magnitude( Actor 2.Position.X - self.Position.X ,Actor 2.Position.Y- self.Position.Y )
But it's not letting me decide to pick Actor 2's position, should I pass the data through another means?
Comments
Sorry think I worked it out, make two new attributes and then do change attribute in the second actor, self.postion.x to game.newattributex, then I can link the data back to the expression in the first actor!
I will have a fiddle, haven't made it work but think I'm in the right direction!
Yes -- you have it. It would look like this:
You could also use a constrain attribute behavior to get a continuously updating position.