Yeah, take this for example:
Code: Select all
no_select_punch:
lda control_pad
eor control_old
and #b_punch
beq no_b_punch
jsr yes_b_punch
In this bit of code, the action you're performing will happen on button down, and button up. That doesn't mean it wouldn't be helpful though. Think about games that require your shot to be powered up and then released, like most of the Mega Man games. This also happens less obviously in Super C while you have the fire weapon.
Like the earlier one I posted:
Code: Select all
no_select_punch:
lda control_pad
eor control_old
and control_pad
and #b_punch
beq no_b_punch
jsr yes_b_punch
Great for single shot weapons, or weapons that don't repeat themselves. Like Contra when you have your regular weapon (did anyone else call this weapon or other regular weapons in different games a pee-shooter, or is it just me?)
This example is what most of us know:
Code: Select all
no_select_punch:
lda control_pad
and #b_punch
beq no_b_punch
jsr yes_b_punch
Where the action performed is repeated over and over very quickly. Of course it's great for moving the sprite with the D-Pad, making it an easy code to employ (though I haven't gotten into animating sprites yet, so we'll see how far I can carry that comment haha). But from a designer stand point you can also think of it as another way to have a weapon utilized. Back to the the Contra example, think of it like when you pick up the machine gun. You no longer have to press the button repeatedly like in the previous example, just hold it down and have a stream of bullets. Of course if you're firing horizontally and using sprites you'll have to code a way for them to not disappear entirely. All of these examples are just ways to employ the controlling scheme, but there are obvious other things you have to do in the code when JSRing to the next bit.
Anyway, I'm getting way off the subject on my own thread here! I've gotten it to move upwards, but LOOKS like 3-4 are on screen at one time as well (though it seems to be the one), then wrapping around, so the cmp isn't working how I planned. I put it all back in one subroutine right now, since it's the closest I've been to accomplishing it so far:
Code: Select all
yes_b_punch:
lda sprite01+3 ; Take X position of the ship and
sta sprite02+3 ; copy it to the X pos of the bullet
lda sprite01 ; Take Y position of the ship and
sta sprite02 ; copy it to the Y pos of the bullet
lda sprite02
: dec sprite02
cmp #$08
bne :-
rts
I also noticed that while the shot is going, and I move diagonal, it slows down. I'm not sure if I will have to reorder my control routine to help that out or not, as I haven't experimented with that yet.
I haven't tried any kind of math with it yet, which I think I'm about to try right now. Thanks for the feedback!