diff --git a/src/bullets.h b/src/bullets.h index ae179fc..0b28108 100644 --- a/src/bullets.h +++ b/src/bullets.h @@ -6,6 +6,9 @@ #define BULLET_DIST FIX32(4) #define BULLET_DIST_BIG FIX32(8) + +// lifecycle + void spawnBullet(struct bulletSpawner spawner, void(*updater)){ s16 i = -1; for(s16 j = 0; j < BULLET_COUNT; j++) if(!bullets[j].active && i == -1) i = j; diff --git a/src/player.h b/src/player.h index c513fb6..a8d0a12 100644 --- a/src/player.h +++ b/src/player.h @@ -45,10 +45,11 @@ void collideObstacleWithPlayer(s16 i){ fix16Add(obstacles[i].pos.x, obstacles[i].size.x) > fix16Sub(player.pos.x, PLAYER_OFF) && obstacles[i].pos.y < fix16Add(player.pos.y, PLAYER_OFF) && fix16Add(obstacles[i].pos.y, obstacles[i].size.y) > fix16Sub(player.pos.y, PLAYER_OFF) - ){ if(obstacles[i].pos.x > player.pos.x) player.pos.x = fix16Sub(fix16Sub(obstacles[i].pos.x, FG_SPEED), PLAYER_OFF); + // else if(fix16Add(obstacles[i].pos.x, obstacles[i].size.x) > fix16Sub(player.pos.x, PLAYER_OFF)) player.pos.x = fix16Add(fix16Add(obstacles[i].pos.x, obstacles[i].size.x), PLAYER_OFF); else if(obstacles[i].pos.y > player.pos.y) player.pos.y = fix16Sub(obstacles[i].pos.y, PLAYER_OFF); + else if(fix16Add(obstacles[i].pos.y, obstacles[i].size.y) > fix16Sub(player.pos.y, PLAYER_OFF)) player.pos.y = fix16Add(fix16Add(obstacles[i].pos.y, obstacles[i].size.y), PLAYER_OFF); checkPlayerBounds(); } }