Re-position Actor before Path assignment
Posted: Mon Jun 02, 2008 5:34 pm
I've come across this small problem while moving some objects in a `dropping` style in a game I'm working on. Basically I need to move the Actor sprite up, say by 100 pixels, then attaching a path that moves the Actor back down, ending with a `bounce`motion. The path works perfectly but I can't reposition the actor AND assign the Path. Here's an example...
Make a basic Path that will move the Actor down about 100 pixels, call it `testpath`. Create an Actor and place it at screen centre (0,0). Add a MouseDown event to the actor and in the script put-
test.y -=200;
Run it and the Actor moves up by 200 pixels.Fine. Now put-
ChangePath("test", "test", Y_AXIS);
after the above code. Now I expected (hoped) that the Actor would move up 100 pxls and then start back down on the Path.
But it jumps straight to the Path movement, skipping the Y repositioning code. I guess the Path is grabbing the co-ordinates as the script is run, and as Paths are relative to the Actor it's somehow overriding the Y position line. Is this normal ? And is there a way around it within one single Actor script ?
Make a basic Path that will move the Actor down about 100 pixels, call it `testpath`. Create an Actor and place it at screen centre (0,0). Add a MouseDown event to the actor and in the script put-
test.y -=200;
Run it and the Actor moves up by 200 pixels.Fine. Now put-
ChangePath("test", "test", Y_AXIS);
after the above code. Now I expected (hoped) that the Actor would move up 100 pxls and then start back down on the Path.
But it jumps straight to the Path movement, skipping the Y repositioning code. I guess the Path is grabbing the co-ordinates as the script is run, and as Paths are relative to the Actor it's somehow overriding the Y position line. Is this normal ? And is there a way around it within one single Actor script ?