To do this we'd reverse the condition.
You see, as it stands right now the Assembly code is checking with BNE -- "Not Equal".
Well, since we don't want to jump on the first instance where the object is wrong, we need to change it around a bit.
Code:
LDA Object_type,x ;This line loads the object type of the object that just collided with the block.
CMP #$03 ;Now we CoMPare to the number #$03 (03 in hex, 3 in decimal)
BNE dontBreakThisBlock ;If not equal, jump to dontBreakThisBlock
could be changed to
Code:
LDA Object_type,x
CMP #$03
BEQ breakThisBlock ;Branch if equal, rather than Branch if not equal that the old code uses.
;Below I mention the "branch distance limit." The line above is the first branch we're working with so this is where that limit comes in.
CMP #$04 ;Just need the object ID we want to check for changed.
BEQ breakThisBlock
CMP #$05 ;And we can do this as many times as we need up to the branch distance limit.
BEQ breakThisBlock
JMP dontBreakThisBlock ;If none of our jumps happened then it's not any of those object types.
breakThisBlock: ;But we need an extra label here so that we can jump to it if true!
;Rest of the code for the breakable block goes here.
The reason the code was written "Load object, check type, skip if not equal" is because it takes up less space that way.
But the moment you need to check for multiple situations you've got to do them one at a time, and suddenly just skipping the whole thing if not equal isn't an option.
So we rewrite it to check if it IS equal, and if so run our code.
If none of our options fire off (none of the object types are equal) then we do one last JuMP to the place the original code skipped to.
I hope this helps you understand the code and how it's working a little better, and I hope this solves your problem!
Edit:
Explaining the "Branch Distance Limit"
The way the processor the NES uses keeps track of where it is in your code is a value called the "Program Counter." When you do a branch (like BNE or BEQ) the computer adds the distance of the jump to the program counter. The problem is, the program counter can only jump 126 bytes backward or 129 bytes forward. So if you try to squeeze too much code between branch statements you'll get a "Branch Out of Range" error.
Yeah this is a little technical, but I figured I'd explain what I meant by "branch distance limit" above.
I'm actually working on some assembly language tutorials if that's something you're interested in learning: http://nesmakers.com/viewtopic.php?f=16&t=953
Anyway, as before, I hope this information helps!