X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2Fgamescr.c;fp=src%2Fgamescr.c;h=64169e73037a023e446c6538bc8f000a2a0f0e0d;hb=ee0d92a6e621e6a8135b16914a09def52bd70a4b;hp=5b3a6d2185590ec8d2f19852720992f6c9a54e5f;hpb=09ff9fd9a87d495d8c2d55203af89d0f651b5d3a;p=gbajam22 diff --git a/src/gamescr.c b/src/gamescr.c index 5b3a6d2..64169e7 100644 --- a/src/gamescr.c +++ b/src/gamescr.c @@ -383,8 +383,8 @@ static int update(void) /* enemy logic */ enemy = enemies; for(i=0; ihp <= 0 || enemy->vobj.px < 0) { + /* only consider enemies which are not dead */ + if(enemy->hp <= 0) { enemy++; continue; } @@ -392,7 +392,8 @@ static int update(void) if(enemy->shot_frame >= 0) { /* in the process of charging a shot */ if(++enemy->shot_frame >= NUM_SHOT_FRAMES - 1) { - if(!did_strafe) { + /* only get hit if we can see the enemy and we didn't strafe */ + if(!did_strafe && enemy->vobj.px >= 0) { hit_frame = 1; if(--energy <= 0) { gameover = 1; @@ -400,7 +401,7 @@ static int update(void) } enemy->shot_frame = -1; } - } else { + } else if(enemy->vobj.px >= 0) { /* check rate of fire and start a shot if necessary */ if(timer_msec - enemy->last_shot >= E_RATE) { enemy->last_shot = timer_msec;