PDA

View Full Version : hey back again



keke
February 22nd, 2007, 10:52 PM
another question. sorry guys.
hope you can keep up:

basically i have a diggin game. players control the spade with the arrow keys, press space to make it go to the next frame in that movie clip and make an animation play that has a code halfway through that digs up dirt.
what i'm really stuck with is i have no idea how to make the player not be able to move the spade when the digging animation is playing.

any help would be so appreciated.

Qwerty the Asdf
February 23rd, 2007, 01:33 AM
While the animation is playing set a variable, digging, equal to true. Then once the animation stop, set the variable back to false.

Add an actions layer to the animation, on the second frame (the start of the animation):
digging = true;
Then on the last frame of the animation, if it loops it back to frame 1 you can set in frame 1:
digging = false;

For the if(Key.isDown(Key.[move]) part that handles spade movement add:
!digging
//if not digging

So it reads:
if(Key.isDown(Key.[move]) && !digging) {
//actions;
}

This will disable the ability to move while digging. Manipulate the code given and you should be able to easily implement it into your movie.

Or, since space handles the animation, you can add the boolean digging variable to true directly onto the key stroke. Then set it back to false in the last frame of the animation.

Hope this helped.