I've been trying to code a simple shooter, but right now I'm stuck at making a bullet move forward. What I do is have the bullet as a sprite, which will be offscreen and not visible, when the player shoots, it appears in the X and Y positions of the ship. Then, nothing happens. It just won't go upwards no matter what I've tried. The bullet sits still and won't move. Here is what I'm attempting:
I'm not quite sure what I'm doing wrong, so any insight would be appreciated.
Man, after looking at my loop, I know that's wrong in itself, but I have tried many different things, and this is the last one I have recently tried.
Code:
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
cmp #$08 ; Compare A to sprite02 then
beq :+ ; branch on equal 0 after
dec sprite02 ; decrementing the bullet to move
: ; upward
rts
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
cmp #$08 ; Compare A to sprite02 then
beq :+ ; branch on equal 0 after
dec sprite02 ; decrementing the bullet to move
: ; upward
rts
I'm not quite sure what I'm doing wrong, so any insight would be appreciated.
Man, after looking at my loop, I know that's wrong in itself, but I have tried many different things, and this is the last one I have recently tried.