Cool! This sounds like fun! *Cracks knuckles* Gonna have to be completely untested code, though, I'm at work ='(
*Ahem*...So, I'm going to assume you are using a class to store all of the player's information like position, angle, animation state, etc. So here is a real basic player class I'll use(without all the jee-gaws like movement and such);
class player
{
public:
kneel_animation( )
{
// Switch for animation!
switch( anim_state )
{
case '1': // begin kneeling
dbLoopObject( PLAYER_OBJ, 1, 50 );
if( dbObjectFrame( PLAYER_OBJ ) == 30 )
anim_state = '2';
return 0;
case '2':
dbLoopObject( PLAYER_OBJ, 30, 50 );
return 0;
default:
somerandomeanimWOOT!;
return 0;
}
}
private:
int anim_state;
};
Now that we have that class with the kneel animation routine, we need some basic proto-code to go with it!
MainLoop
ControlPlayer
ifKneelKeyIsPressed
anim_state = 'a'
ifKneelKeyIsNotPressed
anim_state = 'z' // sends model to default animation
Like I said, the player class is not tested, but I think it will work. If not well, it should at least give you an idea of how it would be done. Using a switch statement and monitoring the objects animation frames, you should be able to switch to the appropriate frame even from inside the switch.
Cheers, hope that helps! Will test it when I get home lol
Tux is my guildmaster.