Add world collisions to shmup
@@ -63,9 +63,9 @@ void Update_Shmup() {
if (shooter_horizontal) {
// Check input to set player movement
- if (INPUT_UP && Gt16(player.pos.y, 8)) {
+ if (INPUT_UP && Gt16(player.pos.y, 8) && !TileAt(tile_x, tile_y - 1)) {
player.dir.y = -1;
- } else if (INPUT_DOWN && Lt16(player.pos.y, (image_height - 8))) {
+ } else if (INPUT_DOWN && Lt16(player.pos.y, (image_height - 8)) && !TileAt(tile_x, tile_y + 1)) {
player.dir.y = 1;
} else {
player.dir.y = 0;
@@ -101,9 +101,9 @@ void Update_Shmup() {
} else {
// Check input to set player movement[]
- if (INPUT_LEFT && (player.pos.x > 0)) {
+ if (INPUT_LEFT && (player.pos.x > 0) && !TileAt(tile_x, tile_y)) {
player.dir.x = -1;
- } else if (INPUT_RIGHT && Lt16(player.pos.x, image_width - 16)) {
+ } else if (INPUT_RIGHT && Lt16(player.pos.x, image_width - 16) && !TileAt(tile_x + 2, tile_y)) {
player.dir.x = 1;
} else {
player.dir.x = 0;
