ForumsProgramming ForumI need help from people who know this stuff

4 2576
Samurai7x
offline
Samurai7x
64 posts
Nomad

I will need to ask lots of questions but my first one is how do you make a movie clip go towards the mouse cursor. I need big help, please help!!!!

  • 4 Replies
dank
offline
dank
986 posts
Peasant

In pseudocode because I'm too lazy to write it in both:

dx = mc.x - mousex;
dy = mc.y - mousey;
length = sqrt( dx*dx + dy*dy );
dx /= length;
dy /= length;
dx *= speed;
dy *= speed;
mc.x += dx;
mc.y += dy;

Samurai7x
offline
Samurai7x
64 posts
Nomad

thx

Samurai7x
offline
Samurai7x
64 posts
Nomad

also how do you make a walking/attacking clip??

Klaushouse
offline
Klaushouse
2,770 posts
Nomad

Have a movie clip with your guy, then put movie clips of him walking and attacking in separate frames within the char MC, and have them all be stop(); 'ed and then play them when they need to be played.

Showing 1-4 of 4