I need help on "Move To" behavior. Strange things happening.
cbt
Member Posts: 644
As the title says, or it is just me...
I'm trying to do something like this;
An actor named "Moving" should "Move To";
X: Random(200,280)
Y: -200
This did not work! "Moving" actor started to go to positions like X=500 or X=0. So, I made a self.RandomX.
Change Attr.
self.RandomX=rand(200,280)
Move to:
X:self.RandomX
Y:-200
And ofcourse;
Display Text:
self.RandomX
It ALL seems OKAY. On the actor 210 is visible as the "Move To" X coordinate, but, it just goes somewhere irrelevant.
Maybe I wasn't so clear, so, here is what is going on;
http://gamesalad.com/game/9930
Just start it and watch for few seconds. Than everything starts to go wrong. What is this about?
I'm trying to do something like this;
An actor named "Moving" should "Move To";
X: Random(200,280)
Y: -200
This did not work! "Moving" actor started to go to positions like X=500 or X=0. So, I made a self.RandomX.
Change Attr.
self.RandomX=rand(200,280)
Move to:
X:self.RandomX
Y:-200
And ofcourse;
Display Text:
self.RandomX
It ALL seems OKAY. On the actor 210 is visible as the "Move To" X coordinate, but, it just goes somewhere irrelevant.
Maybe I wasn't so clear, so, here is what is going on;
http://gamesalad.com/game/9930
Just start it and watch for few seconds. Than everything starts to go wrong. What is this about?
Comments
Use interpolate or change attribute X instead.
This is BS!
You can make:
Interpolate to X and Y
and experiment with the time frame.
If it should move with different speeds, then it is a bit more complicated.
As I understand, you want them to move out of the screen (hence the -200)
I made a game, where the background moves from top to bottom, and when it's out of screen, it should be recicled on the top.
I simply used a move behavior with direction 270 and placed a "wall" actor on the spot, where the image was fully out of screen.
Then I said, if collide with WALL, change X to "whatever"
Now you can do the same, but when it collides with the wall, you can add the rule, you want to happen.
I solved the problem, but with a crappy method..
I created an integer on the actor, "self.Number"
-Change self.Number to rand(0,5)
-If self.number=0;
-Move to; X=200 Y=-200
-If self.number=1;
-Move to; X=240 Y=-200
etc.
etc.
At least it looks like random to the player...