#include #include #include #include #include #include #include #include #include /* Les balles ont les memes propriétés que les boulets et sont donc gérées ici */ static bonus_t bullets[2] = { {0, {0,0,TILE_W/2,TILE_H/2,0,0,0,1}, 0}, {0, {0,0,TILE_W/2,TILE_H/2,0,0,0,1}, 0} }; void bulletThrow() { for (int i=0; i<2; i++) { if (bullets[i].type==0) { bullets[i].type=1; bullets[i].b.x=mario.p.x; bullets[i].b.y=mario.p.y+8; if (mario.last_vx_sgn==0) bullets[i].b.vx=-9; //speed = 9 else bullets[i].b.vx=9; bullets[i].b.vy=0; bullets[i].p1=mario.last_vx_sgn; return; } } } void bulletsDraw() { for (int i=0; i<2; i++) if (bullets[i].type==1) tileDraw(bullets[i].b.x-cameraX(), bullets[i].b.y-cameraY(), &bullet, (1+sgn(bullets[i].b.vy))/2, 0); } void bulletsMove() { for (int i=0; i<2; i++) if (bullets[i].type) // bullet active { boxJump(&bullets[i].b,4); boxMove(&bullets[i].b); if (bullets[i].b.vx==0) bullets[i].type=0; // delete a bullet if it is stopped if (bullets[i].b.y<0) bullets[i].type=0; // delete a bullet if it is out of the map if (bullets[i].b.x<=cameraX()-bullets[i].b.w || bullets[i].b.x>=cameraX()+127) bullets[i].type=0; // delete a bullet if it is out of the screen // contact with ennemies for (int a=0; a