nesdev.com
http://forums.nesdev.com/

How to partially render a sprite that is popping up slowly?
http://forums.nesdev.com/viewtopic.php?f=3&t=14287
Page 1 of 1

Author:  charrli [ Mon May 23, 2016 10:53 pm ]
Post subject:  How to partially render a sprite that is popping up slowly?

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

Attachments:
File comment: The mushroom is supposed to be rendered partially, only the part that is above the block is drawn.
mushroom1.jpg
mushroom1.jpg [ 23.41 KiB | Viewed 1507 times ]

Author:  DRW [ Mon May 23, 2016 11:02 pm ]
Post subject:  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).

Author:  Memblers [ Tue May 24, 2016 1:58 am ]
Post subject:  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

Author:  3gengames [ Tue May 24, 2016 12:42 pm ]
Post subject:  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.

Author:  charrli [ Tue May 24, 2016 4:17 pm ]
Post subject:  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.

Page 1 of 1 All times are UTC - 7 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/