It is currently Mon Oct 23, 2017 8:06 am

All times are UTC - 7 hours





Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: Mon May 23, 2016 10:53 pm 
Offline

Joined: Mon May 23, 2016 10:41 pm
Posts: 2
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 1515 times ]
Top
 Profile  
 
PostPosted: Mon May 23, 2016 11:02 pm 
Offline
User avatar

Joined: Sat Sep 07, 2013 2:59 pm
Posts: 1405
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).

_________________
Available now: My game "City Trouble".
Website: https://megacatstudios.com/products/city-trouble
Trailer: https://youtu.be/IYXpP59qSxA
Gameplay: https://youtu.be/Eee0yurkIW4
German Retro Gamer article: http://i67.tinypic.com/345o108.jpg


Top
 Profile  
 
PostPosted: Tue May 24, 2016 1:58 am 
Offline
Site Admin
User avatar

Joined: Mon Sep 20, 2004 6:04 am
Posts: 3471
Location: Indianapolis
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


Top
 Profile  
 
PostPosted: Tue May 24, 2016 12:42 pm 
Offline
Formerly 65024U

Joined: Sat Mar 27, 2010 12:57 pm
Posts: 2257
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.


Top
 Profile  
 
PostPosted: Tue May 24, 2016 4:17 pm 
Offline

Joined: Mon May 23, 2016 10:41 pm
Posts: 2
Thanks all! I guess you guys have pointed out the reason. Let me try the fix and back to you.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 7 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group