Post by BeasTie on Dec 16, 2012 22:38:40 GMT -5
Practical Juggling
Who doesn't love juggling moves right? Problem is, the typical method of leaving bboxes in a fall animation also allows hits on the ground. Unless the module is designed that way this is at best cheap or too "loose". At worst, it is the culprit of weird and bug inducing problems (like grabbing a fallen character).
There are some complex solutions out there, but since the introduction of landframe you need not give yourself such a headache. Here is how I do it using this very simple juggle trick. It will give you bug free basic juggling without allowing cheap OTG hits.
Here is how it works:
1. Character is knocked down, and his fall has the standard stuff. Attack box to hit others if thrown, delay, offset etc.
2. Character also has a bbox, so he can be knocked around.
3. Notice the addition of landframe. When character touches the ground, animation skips to landframe {int}. it's a 0 index, so landframe 3 skips to the fourth frame.
4. The frame right before our intended landing frame has a very long delay, much longer then any fall will take. So until the character actually touches the ground, the animation will stay at this frame.
5. Finally, character touches ground, landframe triggers, and the animation skips to target landframe. For this and any subsequent frames, the bbox and attack boxes are turned off, and just to be safe we go back to a more sensible delay.
End result: Character is vulnerable in the air during a fall, but becomes invincible once he touches the ground, just like most juggle enabled fighting games. A nice side effect is that the animation just looks better since the "laying" sprite, which usually is not visually appropriate for in air falling won't be seen until it should be.
Still want OTG hits? I reccomend scripting a specific attack to target downed characters that comes out based on proximity to the downed character and apply hit/damage directly without using collision detection. That way you get the brutality of hitting people while they are down without cheap or overly loose gameplay, but that's for another tutorial.
DC
Who doesn't love juggling moves right? Problem is, the typical method of leaving bboxes in a fall animation also allows hits on the ground. Unless the module is designed that way this is at best cheap or too "loose". At worst, it is the culprit of weird and bug inducing problems (like grabbing a fallen character).
There are some complex solutions out there, but since the introduction of landframe you need not give yourself such a headache. Here is how I do it using this very simple juggle trick. It will give you bug free basic juggling without allowing cheap OTG hits.
anim fall
landframe 3
delay 10
offset 100 200
bbox 10 20 10 20
attack 10 20 10 20 5 1
frame data/chars/dude/dude0001.gif #Falling.
frame data/chars/dude/dude0002.gif #Falling.
delay 1000
frame data/chars/dude/dude0003.gif #Falling.
delay 10
bbox 0
attack 0
frame data/chars/dude/dude0004.gif #On the ground.
Here is how it works:
1. Character is knocked down, and his fall has the standard stuff. Attack box to hit others if thrown, delay, offset etc.
2. Character also has a bbox, so he can be knocked around.
3. Notice the addition of landframe. When character touches the ground, animation skips to landframe {int}. it's a 0 index, so landframe 3 skips to the fourth frame.
4. The frame right before our intended landing frame has a very long delay, much longer then any fall will take. So until the character actually touches the ground, the animation will stay at this frame.
5. Finally, character touches ground, landframe triggers, and the animation skips to target landframe. For this and any subsequent frames, the bbox and attack boxes are turned off, and just to be safe we go back to a more sensible delay.
End result: Character is vulnerable in the air during a fall, but becomes invincible once he touches the ground, just like most juggle enabled fighting games. A nice side effect is that the animation just looks better since the "laying" sprite, which usually is not visually appropriate for in air falling won't be seen until it should be.
Still want OTG hits? I reccomend scripting a specific attack to target downed characters that comes out based on proximity to the downed character and apply hit/damage directly without using collision detection. That way you get the brutality of hitting people while they are down without cheap or overly loose gameplay, but that's for another tutorial.
DC