Exemplo n.º 1
0
SDL_Rect gun :: get_position(Dot myDot, Setup foo)
{
    if(look_up)
    {
        box.x = myDot.box.x;
        box.y = myDot.box.y;
        weapons2T.loadFromFile( "first_test16.bmp" );
    }

    else if(look_down && !myDot.is_onGround())                      ///very much so temp--- this should be its own move, once i get moves sorted :D
    {
        box.x = myDot.box.x;
        box.y = myDot.box.y + (myDot.box.h - speed);
        weapons2T.loadFromFile( "first_test15.bmp" );
    }

    else
    {

         if(!direction)
         {
             box.x = myDot.box.x +  (trueWidth - speed);
             weapons2T.loadFromFile( "first_test14.bmp" );
         }
         else
         {
             box.x = (myDot.box.x - 128) + (128 - trueWidth);
             weapons2T.loadFromFile( "first_test13.bmp" );
         }
         box.y = myDot.box.y + trueHeight/2;
    }
    return box;
}
Exemplo n.º 2
0
SDL_Rect sword :: get_position(Dot myDot, Setup foo)
{
    if(look_up)
    {
        box.x = myDot.box.x;
        box.y = (myDot.box.y - le) + properHeight;
        weaponsT.loadFromFile( "first_test12.bmp" );

    }

    else if(look_down && !myDot.is_onGround())                      ///very much so temp--- this should be its own move, once i get moves sorted :D
    {
        box.x = myDot.box.x;
        box.y = myDot.box.y + myDot.box.h;
        weaponsT.loadFromFile( "first_test11.bmp" );
    }

    else
    {

         if(!direction)
         {
             box.x = myDot.box.x +  trueWidth;
             weaponsT.loadFromFile( "first_test10.bmp" );
         }
         else
         {
             box.x = (myDot.box.x - 128) + (128 - trueWidth);
             weaponsT.loadFromFile( "first_test9.bmp" );
         }
         box.y = myDot.box.y + trueHeight/2;
         return box;
    }
}
Exemplo n.º 3
0
void gun:: weaponControl(Dot myDot)
{
 // Uint8 *keystates = SDL_GetKeyState( NULL );
    Mix_PlayChannel( -1, gunSound, 0 );
    if(!direction)
    {
        right = true;
        left = false;
    }
    else
    {
        left = true;
        right = false;
    }

    if(up)
    {
         look_up = true;
         right = false;
         left = false;
    }

    else
    {
         look_up = false;
    }

    if(down && !myDot.is_onGround())
    {
         look_down = true;
    }

    else
    {
         look_down = false;
    }

    for( int p = 0; p < 20; p++ )
    {
        particles[ p ] = new Particle( box.x, box.y, 4);
    }

}