I'm still working on these Nerdy Nights tutorials and I'm almost done : ) I'm having some trouble though working out a feature. Any help would be appreciated. I'm trying to add a timer to the release of the ball. For example, currently when the play screen is loaded the ball immediately begins moving towards a paddle. I instead would like the play screen to load, and the ball NOT appear for a few seconds to allow the players to ready themselves. To achieve this, I came up with a timer that I insert before the ball sprite initialization code. I have separated the code into sections to make this easier to read. Here is the timer. The amount of time the timer waits is controlled by the Constant SETREADYFRAMES
Code: Select all
ReadyTimer:
LDX #$00
ReadyTimerInnerLoop:
LDA #$00
STA ReadyFrameCount
ReadyTimerInc:
INC ReadyFrameCount
LDA ReadyFrameCount
CMP #SETREADYFRAMES ;;Currently Set to 200
BNE ReadyTimerInc
INX
CPX #$0A
BNE ReadyTimerInnerLoop
Code: Select all
LoadInitialBallStats:
ReadyTimer:
LDX #$00
ReadyTimerInnerLoop:
LDA #$00
STA ReadyFrameCount
ReadyTimerInc:
INC ReadyFrameCount
LDA ReadyFrameCount
CMP #SETREADYFRAMES
BNE ReadyTimerInc
INX
CPX #$0A
BNE ReadyTimerInnerLoop
;Timer Done. Now Set The Initial Ball Stats and Starting Paddle Position
LDA #$01
STA balldown
STA ballright
LDA #$00
STA ballup
STA ballleft
LDA #$50
STA bally
LDA #$80
STA ballx
LDA #$01
STA ballspeedx
STA ballspeedy
LoadInitialBallStatsDone:
RTS
Any help with this problem would be very much appreciated : )
Thanks All!
-Hundo