shit lmao
This commit is contained in:
parent
06e8e735fb
commit
6adbe1882d
40 changed files with 608 additions and 361 deletions
|
|
@ -83,18 +83,18 @@ void spawnEnemy(u8 type, u8 zone){
|
|||
static void boundsEnemy(u8 i){
|
||||
if((enemies[i].type == ENEMY_TYPE_TEST || enemies[i].type == ENEMY_TYPE_BUILDER) && enemies[i].ints[3] >= 0){
|
||||
s16 h = enemies[i].ints[3];
|
||||
// if the human was collected by player or gone, kill this enemy
|
||||
if(!humans[h].active || humans[h].state == HUMAN_COLLECTED){
|
||||
// if the treasure was collected by player or gone, kill this enemy
|
||||
if(!treasures[h].active || treasures[h].state == TREASURE_COLLECTED){
|
||||
enemies[i].ints[3] = -1;
|
||||
humanBeingCarried = FALSE;
|
||||
treasureBeingCarried = FALSE;
|
||||
killEnemy(i);
|
||||
return;
|
||||
}
|
||||
// carrying: only check for reaching the top
|
||||
else if(enemies[i].pos.y <= FIX32(0)){
|
||||
if(humans[h].active) killHuman(h);
|
||||
if(treasures[h].active) killTreasure(h);
|
||||
enemies[i].ints[3] = -1;
|
||||
humanBeingCarried = FALSE;
|
||||
treasureBeingCarried = FALSE;
|
||||
if(enemies[i].type == ENEMY_TYPE_BUILDER){
|
||||
u8 zone = fix32ToInt(enemies[i].pos.x) / 512;
|
||||
spawnEnemy(ENEMY_TYPE_GUNNER, zone);
|
||||
|
|
@ -149,11 +149,33 @@ static void updateEnemy(u8 i){
|
|||
}
|
||||
|
||||
// enemy->player collision
|
||||
if(enemies[i].onScreen && !gameOver && player.recoveringClock == 0){
|
||||
if(enemies[i].onScreen && !gameOver && player.recoveringClock == 0 && player.respawnClock == 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();
|
||||
// spawn explosion at player position
|
||||
s16 expSlot = -1;
|
||||
for(s16 j = 0; j < BULLET_COUNT; j++) if(!bullets[j].active){ expSlot = j; break; }
|
||||
if(expSlot >= 0){
|
||||
bullets[expSlot].active = TRUE;
|
||||
bullets[expSlot].player = TRUE;
|
||||
bullets[expSlot].explosion = TRUE;
|
||||
bullets[expSlot].pos.x = player.pos.x;
|
||||
bullets[expSlot].pos.y = player.pos.y;
|
||||
bullets[expSlot].vel.x = 0;
|
||||
bullets[expSlot].vel.y = 0;
|
||||
bullets[expSlot].clock = 0;
|
||||
bullets[expSlot].frame = 0;
|
||||
bullets[expSlot].image = SPR_addSprite(&pBulletSprite, -32, -32, TILE_ATTR(PAL0, 0, 0, 0));
|
||||
if(bullets[expSlot].image){
|
||||
SPR_setAnim(bullets[expSlot].image, 1);
|
||||
SPR_setFrame(bullets[expSlot].image, 0);
|
||||
SPR_setHFlip(bullets[expSlot].image, random() & 1);
|
||||
} else {
|
||||
bullets[expSlot].active = FALSE;
|
||||
}
|
||||
}
|
||||
if(enemies[i].type != ENEMY_TYPE_BOSS){
|
||||
enemies[i].hp = 0;
|
||||
killEnemy(i);
|
||||
|
|
@ -163,8 +185,11 @@ static void updateEnemy(u8 i){
|
|||
gameOver = TRUE;
|
||||
XGM2_stop();
|
||||
} else {
|
||||
player.recoveringClock = 120;
|
||||
player.respawnClock = 120;
|
||||
SPR_setVisibility(player.image, HIDDEN);
|
||||
killBullets = TRUE;
|
||||
hitMessageClock = 120;
|
||||
hitMessageBullet = FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue