So, I just got done rewriting my code, so that it could fix a few problems with the code (mainly adding stuff to the NMI), until I got to a section where it uses a sprite 0 split, instead of splitting the screen like it did before so it could show a dialogue box and the background, it's now pushing down the background, so it can display the box. It's a little hard to explain, so here's a drawing of it:
Background:
\\\\\\\\\\\\\\\\\\\\\\\\\\\
\ _________________\
\ _________________\
\ _________________\
\ _________________\
\ _________________\
\ _________________\
\ _________________\
\\\\\\\\\\\\\\\\\\\\\\\\\\\
Before with the box:
---------------------------
|__________________|
|__________________|
---------------------------
\ _________________\
\ _________________\
\ _________________\
\ _________________\
\\\\\\\\\\\\\\\\\\\\\\\\\\\
Now with the box:
---------------------------
|__________________|
|__________________|
---------------------------
\\\\\\\\\\\\\\\\\\\\\\\\\\\
\ _________________\
\ _________________\
\ _________________\
\ _________________\
I hope you guys understand what I mean
Sprite 0 Bug
Moderator: Moderators
Re: Sprite 0 Bug
It looks like you're setting the Y-scroll to 0 at the sprite 0 hit. That's not what you want. Set the scroll to the background position you want to see.
Re: Sprite 0 Bug
That only seems to move the box around, which is not what I meant (unless I'm doing it wrong).
Re: Sprite 0 Bug
It would help to explain exactly what your code is doing - from your description, I can only assume that you're doing a pair of writes to $2006 to point the VRAM address at the beginning of a nametable and then trying to set X/Y scroll using $2005, something which will not work because vertical scroll only updates once per frame (unless you use special tricks, like those described on the PPU scrolling wiki page).
Quietust, QMT Productions
P.S. If you don't get this note, let me know and I'll write you another.
P.S. If you don't get this note, let me know and I'll write you another.
Re: Sprite 0 Bug
It would really help if you could show us what the code around the sprite 0 hit detection looks like.
Re: Sprite 0 Bug
Thanks! It works now!
I've removed the $2006 writes and that was the problem!
Here's how it was
I've removed the $2006 writes and that was the problem!
Here's how it was
Code: Select all
NMI
lda #$00
sta $2006
sta $2006
sta $2005
sta $2005
;other NMI stuff
sprite0
lda #$40
.waitnospr0
bit $2002
bvs .waitnospr0
.waitspr0
bit $2002
bvc .waitspr0
ldx #$00
.waitscan
inx
cpx #$78
bne .waitscan
ldx #$00
lda #$00
sta $2006
sta $2006
lda scrollh
sta $2005
lda scrollv
sta $2005
rts