Problem with shooting animation

I'm having multiple problems atm.
1. player shooting animation not playing
2. arms dont appear when looking left

Here is where i set the clips
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19

// facing right
        for( int i = 0; i < 3; i++ )
        {
            pistolClips[i] = new SDL_Rect;
            pistolClips[i]->x = 0;
            pistolClips[i]->y = 16 * i;
            pistolClips[i]->h = 16;
            pistolClips[i]->w = 36;
        }
        //facing left
        for( int i = 3; i < 6; i++ )
        {
            pistolClips[i] = new SDL_Rect;
            pistolClips[i]->x = 36;
            pistolClips[i]->y = 16 * i;
            pistolClips[i]->h = 16;
            pistolClips[i]->w = 36;
        }



Here is what should draw the arms
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] );
            }
        }


and here is what should set player->shoot to true;
1
2
3
4
5
6

if( keystate[ SDLK_SPACE ] )
{
    shoot = true;
}
Topic archived. No new replies allowed.