Hi everyone,
I'm working on an NES emulator, and the PPU I wrote looks good. However, I found one strange behavior when playing the Super Mario Bros. i found the mushroom, which is supposed to gradually appear on the screen, is actually drawn on the screen entire from the very beginning, and then the entire mushroom sprite moving up. I guess I miss something here for the emulation. Does anyone know what's wrong with this rendering? By the way, to handle the sprite priority, I'm actually drawing from the last sprite to the first sprite (sprite No.63 to Sprite No.0). Please help. Thanks!
Regards,
Charlie
How to partially render a sprite that is popping up slowly?
Moderator: Moderators
How to partially render a sprite that is popping up slowly?
- Attachments
-
- The mushroom is supposed to be rendered partially, only the part that is above the block is drawn.
- mushroom1.jpg (23.41 KiB) Viewed 6092 times
Re: How to partially render a sprite that is popping up slow
Every sprite has a "behind the background"/"in front of the background" flag:
http://wiki.nesdev.com/w/index.php/PPU_OAM#Byte_2
You need to handle this flag correctly, then the mushroom appears behind the block (since the block is a background object).
http://wiki.nesdev.com/w/index.php/PPU_OAM#Byte_2
You need to handle this flag correctly, then the mushroom appears behind the block (since the block is a background object).
My game "City Trouble":
Gameplay video: https://youtu.be/Eee0yurkIW4
Download (ROM, manual, artworks): http://www.denny-r-walter.de/city.html
Gameplay video: https://youtu.be/Eee0yurkIW4
Download (ROM, manual, artworks): http://www.denny-r-walter.de/city.html
Re: How to partially render a sprite that is popping up slow
I don't think SMB uses this, but it's also possible to mask a high-priority sprite behind the background by putting a lower priority sprite, in a lower sprite number, on top of it. SMB3 and Castlevania are a couple games that use that. By priority in this case I mean the foreground/background flag that DRW mentioned.
http://wiki.nesdev.com/w/index.php/PPU_sprite_priority
http://wiki.nesdev.com/w/index.php/PPU_sprite_priority
Re: How to partially render a sprite that is popping up slow
I'm pretty sure one of the Mario's actually does use tiles in front of the sprite to cover it, so just make sure your sprite rendering and background/foreground flags are set up correctly.
Re: How to partially render a sprite that is popping up slow
Thanks all! I guess you guys have pointed out the reason. Let me try the fix and back to you.