Page 1 of 1

Sequence of moves using MoveTo

PostPosted: Tue Oct 04, 2011 1:56 pm
by mcavalcanti
Hello, guys.

Is there a simple way to make a sequence of moves using MoveTo and MoveFinish? For example, I have a ship that make a square move. It comes from the left top of the screen, go down, go to the right, and come back to the top. When Y is smaller than -350, the ship is destroyed.

Code: Select all
if(x==30&&y<80){MoveTo("Event Actor", 30.000000, 80.000000, 8.000000, "Game Center", "");}
else if(x==30&&y>=79){MoveTo("Event Actor", 600.000000, 80.000000, 3.000000, "Game Center", "");}
else if(x==600&&y>=79){MoveTo("Event Actor", 600.000000, -400.000000, 5.000000, "Game Center", "");}
else if(x==600&&y<=-350){DestroyActor("Event Actor");

But it is an amount of code. And I'm avoiding to use paths because I think path moves are, well, not natural. Any good solution? Best.

Re: Sequence of moves using MoveTo

PostPosted: Tue Oct 04, 2011 4:55 pm
by NERDnotGEEK
You can achieve the same effect just adding on x and y values. EG to go in a square from 0 and back to 0 again you'd do this.
Code: Select all
int i;
if(i<50)
{
    y = y - 1;
    i = i + 1;
}
else if(i<100)
{
    x = x + 1;
    i = i + 1;
}
else if (i<150)
{
    y = y + 1;
    i = i + 1;
}
else if (i<200)
{
    x = x - 1;
    i = i + 1;
}





Re: Sequence of moves using MoveTo

PostPosted: Tue Oct 04, 2011 9:53 pm
by mcavalcanti
Hey, thanks! It's working very nice. Many possibilities with this method. :D