I have a Character sprite. For that character, I have a series of frames depicting a Superleap to GroundBash sequence.
He squats, then leaps, is in mid-air, is about to land, and ends in a squat as he punches the ground. That's 6 different frames that I will duplicate in order to create a 48 frame sequence.
I need to figure out how to do the following three things:
1. When the character is clicked on with the mouse, the sprite changes to the SQUATTING frame.
2. While the mouse button is held down, a partial arc appears from the sprite (a la Angry Birds) that shows the sprite's direction and angle of movement when the mouse is released. The arc will change shape and direction, depending on how the mouse is dragged while the Left-mouse button is held.
3. The sprite frames need to move along the movement arc, aligned so the certain frames are aligned properly.
Here is a diagram of what I mean:
<img src="http://i1074.photobucket.com/albums/w414/RogerCotton/SuperLeap.jpg" border="0" />
Any suggestions on how any one of these three things can be accomplished would be appreciated! Thank you.
Develop games in your browser. Powerful, performant & highly capable.
edit : misread.
Figured out the first step.
Now looking at documentation to see how to create a visible arc path.
To create a visible arc path just have your player character spawn a small trail sprite every tick as he moves as in the following:
I have a fade behavior on the trail sprite, but you don't need that if you want to keep the trail around long enough to try aligning the animation.
As for aligning the animation, there are several events that occur in a platform behavior jump: jump, fall and land. You can play different animations at each of these points. In the example I gave there is a test to see if player is moving. There are similar tests to see if player is jumping, falling or landing.
These are non-looping animations, and there should be some overlap of the different poses. So, for example, the jump animation might include the squat, leap and the height of the leap frames. The fall would include the height of the leap and the fall frames. The land would include fall and land frame.
Here is an example:
2. Future positions are calculated in a loop in much the same way as the platform behavior actually moves.
3. Basically like kittiewan said.
Thank you so much, guys! I will try these suggestions.