Page 1 of 1
[solved] Help with Graphics Error in Shooting Test
Posted: Sun Sep 30, 2018 5:01 pm
by skullkid2802
Hello, I am extremely new to NES development, although I've had experience in game development for some time using simple programs such as Fusion 2.5. I discovered NESDoug's examples/tutorials, which show how to program for NES using C. C is much more approachable to me than assembly, which I barely could grasp the basics of, hahah. Well, I started building off of the sprites example he posted
here, and started to implement a shooting script.
Initially,
I couldn't get more than 1 bullet to fire, but I eventually got it to the point where multiple instances could exist, but at the cost of every other sprite disappearing. I can still move the player around, and shoot as many bullets as possible (64 is my implemented limit), but cannot see the player whatsoever.
Here is how it looks and
here is the code. If anyone is willing to assist, and is in need of more files pertaining to this development, I'll be happy to provide. Thank you for reading this, and hopefully you can help me

Re: Help with Graphics Error in Shooting Test
Posted: Sun Sep 30, 2018 5:28 pm
by nesrocks
The NES draws scanlines (horizontal lines of pixels) to complete the entire screen. Each scanline's pixels are drawn from left to right, and it will only draw 8 sprites. After that for that scanline it will ignore the sprites and draw only the nametable/background color. On the next scanline it will reset this counter. What this means is the NES won't draw many sprites that are on the same horizontal line.
So, your options are to program a flickering system (recommended) and/or rethink your game design.
And if that is not the problem then you are overwriting the memory addresses containing the player sprite information when you create shots. You can hard code addresses, or you can create an object/sprite manager with an object queue. There must be a tutorial for this somewhere.
Re: Help with Graphics Error in Shooting Test
Posted: Sun Sep 30, 2018 6:42 pm
by dougeff
if (b1index>0){
as soon as any value is in b1index it does this...
for(index=0;index<64;index++){
sprid = oam_spr(bullet_x[index], bullet_y[index], 0, 0, sprid);
...
}
and always writes every object in the array to the Sprite buffer. All 64.
The Sprite buffer (OAM) can only hold 64 items, so it's overwriting the other items. ie, looping past the end of the buffer and back into the beginning of the buffer.
Reduce the number of objects.
Only draw them if they are active.
BTW. I sent you an email earlier.
Re: Help with Graphics Error in Shooting Test
Posted: Sun Sep 30, 2018 7:53 pm
by skullkid2802
It works beautifully now! I first saw your email NESdoug, which pretty much helped me out through fixing the whole thing, so I thank you again for this.
Here is a video if anyone is interested in seeing the progress. And also, how should I mark this thread as "solved", I'm (obviously) new to these forums.
Re: Help with Graphics Error in Shooting Test
Posted: Mon Oct 01, 2018 8:20 am
by nesrocks
Nice, so it was overwriting

Dougeff rocks.
I don't recall anyone closing an issue here, there's more of like a topics of discussion mentality. That said, you can edit the title of the original post to add a "[Solved]" to it. There's an edit button to the bottom right of your posts.