1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
|
// loop firing animation
if( player->pistolFrame == 3 )
{
player->shoot = false;
player->pistolFrame = 1;
}
// draw
if( player->direction == RIGHT )
{
if( player->shoot )
{
graphics->ApplySurface( player->handgun.xPos, player->handgun.yPos, player->pistol, graphics->screen, player->pistolClips[player->pistolFrame] );
player->pistolFrame++;
}
else
{
graphics->ApplySurface( player->handgun.xPos, player->handgun.yPos, player->pistol, graphics->screen, player->pistolClips[0] );
}
}
else if( player->direction == LEFT )
{
if( player->shoot )
{
graphics->ApplySurface( player->handgun.xPos, player->handgun.yPos, player->pistol, graphics->screen, player->pistolClips[player->pistolFrame + 3] );
player->pistolFrame++;
}
else
{
player->handgun.xPos -= 15;
graphics->ApplySurface( player->handgun.xPos, player->handgun.yPos, player->pistol, graphics->screen, player->pistolClips[3] );
}
}
|