View Full Version : movement in AS
hi,
I am want to create a slow, Lateral (only) movement constrained winthin certain boundries. Does anyone know an actionsript tutorial for that? Thanx in advance.
i have 3 mc's and i would like the movement to be random
toto
JHallam
04-26-2002, 12:11 AM
Ok, here some scrip.
//put this bellow on a MC
onClipEvent (load) {
// minimum and maximum values on x and y axis for your mc
minX = 0;
maxX = 550;
minY = 0;
maxY = 400;
// speed of movement
speed = 2;
// destination of the mc
xDest = random(maxX - minX) + minX;
yDest = random(maxY - minY) + minY;
}
// random movement
onClipEvent (enterFrame) {
if (Math.round(_x) != xDest) {
_x += xDif;
xDif = (xDest - _x) / speed;
} else {
xDest = random(maxX - minX) + minX;
}
if (Math.round(_y) != yDest) {
_y += yDif;
yDif = (yDest - _y) / speed;
} else {
yDest = random(maxY - minY) + minY;
}
}
thank you for your post.
i am new to scripting, so it will take me a while to decifer your code.
i am still looking for a good tutorial re: scripting movement ....any suggestions?
toto
pinkaboo
04-26-2002, 08:51 AM
Is there not a tute in the tutorial section here?
|
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.