So I have my ship shooting... sort of... but when I press and hold the button down the bullet resets to the ship position as it should but it stays there for as long as the button is held down...
I'm using the movement code from Nerdy Nights and it works great for my ship's movement but I'm not sure how I can detect the initial button press down rather than if it's being held down. Sorry if I'm not explaining this well but here's my code. I have another label elsewhere that handles the bullet's movement.
Code: Select all
LatchController: LDA #$01 STA $4016 LDA #$00 STA $4016 ; tell both the controllers to latch buttons ; A button ReadA: LDA $4016 ; player 1 button A AND #%00000001 ; only look at bit 0 BEQ ReadADone ; branch to ReadADone if button is NOT pressed (0) LDX $0217 ; load ship sprite X position STX $021B ; move bullet to ship sprite X position LDX $0214 ; load ship sprite y position DEX ; Move up a few pixels to align with ship DEX DEX STX $0218 ; move bullet to ship sprite Y position ReadADone: ; handling this button is done