This content has been marked as final. Show 6 replies
> try not to laugh buts heres a animation showing what i want lol
You did not ask a question.
I wouldn't put the code on an mousemove handler otherwise you dog only
moves while the mouseposition has changed. But you want the dog to
follow the mouse more slowly otherwise it will have allways the same
position as the mouse.
Put it on an enterFrame handler.
Check if the mouse is more left or more right of the dog and increase or
decrease the dog's position. Use 'else' conditions. Check if the dog has
the right x and y position to the mouse and then trigger your animation.
And what happens if I move the mouse then? If the cursor should stay
there use hide cursor and use a movieclip as cursor that is set to the
position of the mouse.
yea sorry forgot the question lol
i was hoping for someone to show me some code cos i really cant figure it out
Hey sanchez, what you're looking for here is fairly complex. Marco is on the right track, but there's another complication, not only does the dog need to run the walk cycle, but he must walk with each step toward where the mouse currently is and then stop. If you were to simply adjust the _x position of the dog, he will just magically 'snap' to the position of the cursor, so he has to walk though his step sequence until he reaches the mouse point, ya see what I mean?
So beyond setting things up in an onEnterFrame event, you must move the dog slowly through his walk cycle, with each step checking to see if he's reached the mouse position. then run other checks (ie. the vertical ones) to perform a different actions. I have constructed a very simple animation (don't laugh Georgense :) of what you're looking for here, but just the walk cycle, you'll need to work out the jump and sit cycles and add to the basic code construction I'm giving you as an example.
what this does is, at the beginning of the dogs MC, checks for the mouse position, adjusts the needed variables, and sends the playhead to the walk cycle, the walk cycle adjust the position of the clip as it walks, then sends the playhead back to the first frame at the end of the cycle. By doing so, this envokes the method once again and it checks to see if he's reached the current position of the mouse, and if not repeats the walk cycle, and so on. Additionally, there is a onMouseMove event trigger on board with a boolean to control the timing, so that when he's reached the position of the mouse and is just standing there, if the mouse is moved, he begins the sequence once again.
All of the code is within the dog MC, double click to take a look. remember this is a very simple example and the cycle is rough. Also you will need to add to the conditions in the checkPosition method for the verticle mouse position, and then develop the sequences for them, as well as adding methods to handle the change.
Here the FILES
thats awesome thanks! :)
i also got this code... ill be back when i have a finised movie. cos i know ther a alot of people around in lots of forum trying to find something like this