Advertisement
Guest User

Untitled

a guest
May 14th, 2013
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.76 KB | None | 0 0
  1. void drawBullet()
  2. {
  3.     do
  4.     {
  5.         for(int i=0; i<Bullet_No; i++) if(!bullet[i].alive)
  6.             {
  7.                 bullet[i].alive = 1;
  8.                 bullet[i].b.x = player.x + 60 ;
  9.                 bullet[i].b.y = player.y + 30 ;
  10.                 break; // break this for( ) loop
  11.             }
  12.         drawBullet();
  13.         for(int i=0; i<Bullet_No; i++) if(bullet[i].alive)
  14.             {
  15.                 bullet[i].b.x += 5;
  16.                 bullet[i].b.w = bullet[i].w;
  17.                 bullet[i].b.h = bullet[i].h;
  18.                 SDL_FillRect(screen , &bullet[i].b , 0xFFFF66);
  19.                 // Bullet Destroy condition
  20.                 if(bullet[i].b.x > 380) bullet[i].alive = 0;
  21.             }
  22.         break;
  23.     } while (fireBullet = true);
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement