Skip to content

Instantly share code, notes, and snippets.

@gazsp
Created August 31, 2025 09:52
Show Gist options
  • Select an option

  • Save gazsp/cceef35ed68b0a2db7fbb5935213830f to your computer and use it in GitHub Desktop.

Select an option

Save gazsp/cceef35ed68b0a2db7fbb5935213830f to your computer and use it in GitHub Desktop.
Implement sprite flickering on the NES
// Reverse order every other frame to flicker sprites
if (++frame & 1) {
address2 = (u16)&entities;
for(i=1; i<MAX_ENTITIES; ++i) {
e = (Entity*)address2;
processEntity();
address2 += sizeof(Entity);
}
}
else {
address2 = (u16)&entities[7];
for(i=MAX_ENTITIES-1; i != 0; --i) {
e = (Entity*)address2;
processEntity();
address2 -= sizeof(Entity);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment