Hello Guest, please login or register.
Did you miss your activation email?
Login with username, password and session length.

Pages: [1]   Go Down

Author Topic: (Flash MX) Help : Movieclip attempts to jump to reach high mouse cursor  (Read 809 times)

0 Members and 1 Guest are viewing this topic.

ZaC-UK

(Flash MX) Help : Movieclip attempts to jump to ...
« on: December 01, 2006, 05:33:57 pm »
Hello there, this is one of my basic flash beginners tutorials i wanted to attempt but i cannot seem to get it working. I have a movie clip following my mouse at x that slowing eases upto the mouse, Almost like the object is chasing after the mouse along the X axis. I have just one problem. I want that movie clip to attempt to Jump up at the mouse when its on the Y axis, when i left click.
Basically it only needs to try to jump up at the mouse once, only get a certain amount high and then fall back down to the floor and can be repeated once you click again.
EXAMPLE I AM USING
http://www.lionbichstudios.com/flash_tutorials_advanced_onclick.html
This code is on the movie clip to follow the X mouse
Quote
onClipEvent (load) {
   _x = 0;
   speed = 8;
}
onClipEvent (enterFrame) {
   endX = _root._xmouse;
   endY = _root._ymouse;
   _x += (endX-_x)/speed;
   
}

I got this from a tutorial
Quote
onClipEvent (mouseDown) {
targety = _parent._ymouse;
if (targety<0) {
targety = 0;
} else if (targety>900) {
targety = 900;
}
active = true;
}

onClipEvent (enterFrame) {
if (active) {
xdif = targetx-_x;
_x = _x+xdif/5;
ydif = targety-_y;
_y = _y+ydif/5;
if (Math.abs(xdif)<0.200000 && Math.abs(ydif)<0.200000) {
_x = targetx;
_y = targety;
active = false;
}
}
}
onClipEvent (enterFrame) {
if (active) {
xdif = targetx-_x;
xspeed = xspeed+xdif/10;
xspeed = xspeed*0.800000;
_x = _x+xspeed;
ydif = targety-_y;
yspeed = yspeed+ydif/10;
yspeed = yspeed*0.800000;
_y = _y+yspeed;
if (Math.abs(xspeed)<0.020000 && Math.abs(yspeed)<0.020000) {
delete ("active");
delete ("xspeed");
delete ("yspeed");
delete ("xdif");
delete ("ydif");
}
}
}
onClipEvent (enterFrame) {
if (active) {
xdif = targetx-_x;
_x = _x+xdif/5;
ydif = targety-_y;
_y = _y+ydif/5;
if (Math.abs(xdif)<0.200000 && Math.abs(ydif)<0.200000) {
_x = targetx;
_y = targety;
active = false;
}
}
}

This makes the Object move towards the mouse in the air, but doesnot return to the floor. Anyhelp please? I want to get this in progress Asap! Thanks! I do know that
Quote
onClipEvent (mouseDown) {
targety = _parent._ymouse;
if (targety<0) {
targety = 0;
} else if (targety>900) {
targety = 900;
}
active = true;
}
That part of the code when modified can alter the objects movements, would there be anyway to make it reach only a certain set distance up the Y axis and fall back down?
« Last Edit: December 01, 2006, 05:49:38 pm by ZaC-UK »
Logged
Pages: [1]   Go Up

 


Contact Us | Legal | Advertise Here
2013 © ZFGC, All Rights Reserved



Page created in 0.014 seconds with 34 queries.

anything