sfx, explozion
This commit is contained in:
parent
a3f0474ec9
commit
75f6c7d8dc
7 changed files with 146 additions and 12 deletions
30
src/global.h
30
src/global.h
|
|
@ -62,7 +62,7 @@ struct bulletSpawner {
|
|||
bool top, player;
|
||||
};
|
||||
struct bullet {
|
||||
bool active, player, vFlip, hFlip;
|
||||
bool active, player, vFlip, hFlip, explosion;
|
||||
Vect2D_f32 pos, vel;
|
||||
Sprite* image;
|
||||
s16 clock, angle, anim, frame;
|
||||
|
|
@ -87,9 +87,31 @@ struct enemy {
|
|||
};
|
||||
struct enemy enemies[ENEMY_COUNT];
|
||||
|
||||
void killBullet(u8 i){
|
||||
bullets[i].active = FALSE;
|
||||
SPR_releaseSprite(bullets[i].image);
|
||||
void killBullet(u8 i, bool explode){
|
||||
if(explode){
|
||||
if(bullets[i].player){
|
||||
SPR_setAnim(bullets[i].image, 1);
|
||||
} else {
|
||||
s16 a = bullets[i].anim;
|
||||
s16 explosionAnim;
|
||||
if(a < FIRST_ROTATING_BULLET){
|
||||
explosionAnim = 13 + bullets[i].frame;
|
||||
} else {
|
||||
s16 mod = a % 3;
|
||||
explosionAnim = 13 + mod;
|
||||
}
|
||||
SPR_setAnim(bullets[i].image, explosionAnim);
|
||||
}
|
||||
bullets[i].clock = 0;
|
||||
bullets[i].frame = 0;
|
||||
bullets[i].explosion = TRUE;
|
||||
SPR_setFrame(bullets[i].image, 0);
|
||||
SPR_setHFlip(bullets[i].image, random() & 1);
|
||||
// SPR_setVFlip(bullets[i].image, random() & 1);
|
||||
} else {
|
||||
bullets[i].active = FALSE;
|
||||
SPR_releaseSprite(bullets[i].image);
|
||||
}
|
||||
}
|
||||
|
||||
void killEnemy(u8 i){
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue