lots of work
This commit is contained in:
parent
4036b5f07e
commit
06648c2dc1
18 changed files with 640 additions and 113 deletions
|
|
@ -49,10 +49,12 @@ void spawnEnemy(u8 type, u8 zone){
|
|||
enemies[i].active = FALSE;
|
||||
return;
|
||||
}
|
||||
SPR_setVisibility(enemies[i].image, HIDDEN);
|
||||
enemies[i].hp = 1;
|
||||
for(u8 j = 0; j < PROP_COUNT; j++){
|
||||
enemies[i].ints[j] = 0;
|
||||
}
|
||||
enemies[i].ints[3] = -1;
|
||||
switch(enemies[i].type){
|
||||
case ENEMY_TYPE_TEST:
|
||||
loadEnemyOne(i);
|
||||
|
|
@ -146,9 +148,31 @@ static void updateEnemy(u8 i){
|
|||
break;
|
||||
}
|
||||
|
||||
// enemy->player collision
|
||||
if(enemies[i].onScreen && !gameOver && player.recoveringClock == 0){
|
||||
fix32 edx = getWrappedDelta(enemies[i].pos.x, player.pos.x);
|
||||
fix32 edy = enemies[i].pos.y - player.pos.y;
|
||||
if(edx >= FIX32(-16) && edx <= FIX32(16) && edy >= FIX32(-16) && edy <= FIX32(16)){
|
||||
sfxExplosion();
|
||||
if(enemies[i].type != ENEMY_TYPE_BOSS){
|
||||
enemies[i].hp = 0;
|
||||
killEnemy(i);
|
||||
}
|
||||
player.lives--;
|
||||
if(player.lives == 0){
|
||||
gameOver = TRUE;
|
||||
XGM2_stop();
|
||||
} else {
|
||||
player.recoveringClock = 120;
|
||||
killBullets = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
s16 sx = getScreenX(enemies[i].pos.x, player.camera);
|
||||
s16 sy = fix32ToInt(enemies[i].pos.y);
|
||||
SPR_setVisibility(enemies[i].image, enemies[i].onScreen ? VISIBLE : HIDDEN);
|
||||
SPR_setHFlip(enemies[i].image, enemies[i].vel.x > 0);
|
||||
SPR_setPosition(enemies[i].image, sx - enemies[i].off, sy - enemies[i].off);
|
||||
|
||||
enemies[i].clock++;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue