I need some help with reading from PPU. I am following the Nesdoug tutorial series and want to code a collision check between
a sprite and a background tile. Thus Doug mentions that reading from PPU while doing background collision is quite ugly, I would
like to give it a shot. Here is my code
Code: Select all
#define VOID_TILE 0x00
#define OBSTICLE_TILE 0x01
#define NAMETABLE 0x2000
#define BG_ADR(x,y) ((y<<2)|(x>>3))
#define MSB(x) (((x)>>8))
#define LSB(x) (((x)&0xff))
...
void render_routine(void){
wait_until_nmi();
PPU_ADDRESS = MSB(NAMETABLE + BG_ADR(projectile_x, projectile_y));
PPU_ADDRESS = LSB(NAMETABLE + BG_ADR(projectile_x, projectile_y));
if(PPU_DATA == OBSTICLE_TILE){
PPU_DATA = VOID_TILE;
}
reset_scrolling();
}
...
place on the screen (but on the same line). Can somebody help? Also it would be interesing, if it is common style to avoid
PPU reading while doing background collision cheks and therefore maintain internal collision maps, like in Nesdoug's tutorial series.
Regards
Sebastian