Question about punching

Blitz3D Forums/Blitz3D Programming/Question about punching

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

What I would do would be to have a basic Fight Idle animation running continually when no other action is triggered.
I would then check to see if KeyHit(40) occured.
If the Punch button has been hit first of all check to see if we are already in the punching sequence and if so are we at a frame where we can throw another punch. If yes then do the Punch Sequence.
If we are in the Fight Idle sequence then just trigger the Punch Sequence.
As the Punch Animation sequences are 'one-shot' we can check when the animation has stopped and return to the Fight Idle sequence.



IF KeyHit(40) AND AnimSeq(Char_1)=7 And AnimTime(Char_1)> A_frame_where_its_ok_to_rerun_the_sequence THEN
    Animate Char_1,3,1.25,7,5 'one-shot punch sequence
END IF
IF KeyHit(40) AND AnimSeq(Char_1)= fight_idle THEN
       Animate Char_1,3,1.25,7,5 'one-shot punch sequence 
END IF

IF NOT Animating(Char_1) THEN   Animate Char_1,1,1.25,fight_idle,5  'looping fight_idle sequence

This will ensure that when the punch sequence finishes the model will return to the fight idle sequence ready for another punch.

For simplicity you could leave out the first check and only trigger the punch sequence when the model is in Fight Idle mode - this does mean though that you couldn't trigger another punch until the previous was fully completed. Depending on how you have created your animations this may not be a problem.