These examples have all dealt with the _x (X position) only, but _y is just a easily manipulated. Our very first example showed this:

Now the circle desperately chases our mouse in both directions (vertically (y direction) and horizontally (x direction) and all I did was change the controller commands to:

if (_root._xmouse>_level0.circle._x) {
 _level0.circle._x = (_level0.circle._x+10);
} else {
 _level0.circle._x = (_level0.circle._x-10);
}
if (_root._ymouse>_level0.circle._y) {
 _level0.circle._y = (_level0.circle._y+10);
} else {
 _level0.circle._y = (_level0.circle._y-10);
}

ie. Exactly the same as the previous example, but with a duplicate cause for _y which is just the _x clause where every "_x" has been replaced by a "_y".

Good huh? And easy too no less. Many of you will want to replicate the original Yugop effect in which the further from the center of the stage you go in any direction, the faster the movie moves. This is very simply done by adapting the source above. Remember that faster movement is achieved by simply increasing the number of pixels added to or subtracted from the _x or _y property of the clip. I'll let you figure that much out yourself though. You've got to start somewhere! If you havea ny questions please post them on the forums rather than emailing me directly.

Jesse Stratford is the Co-Master of ActionScript.org and a freelance Flash developer and teacher. He is based in Australia and enjoys all things Flash.

NB: If you have comments or feedback please feel free to email me, but please do not email me Flash questions; the forums are provided for that purpose and you will get a faster answer by posting you question there.

If you have found this tutorial helpful, I hope that you will take 30 seconds to visit The Hunger Site where, with just one click you can make a free donation of food to a starving person in a third-world country. We do not benefit financially from this action; it is purely an act of charity.
This tutorial is protected by International Intellectual Property Rights laws and may not be reproduced or redistributed in full or part, without the prior written consent of the author. Unauthorized reproduction of this tutorial or its contents may result in prosecution. I've worked hard on this tutorial, please don't steal it.