set kernel_options no_blank_lines const noscore = 1 rem player0score = $99 rem player1score = 0 const WASUP = 1 const WASCENTEREDAFTERUP = 2 const WASRIGHT = 3 const WASCENTEREDAFTERRIGHT = 4 const COUNTRUNNINGFRAMES = 12 const HALFRUNNINGFRAME = 7 const COUNTPANTINGFRAMES = 80 const HALFPANTINGFRAME = 30 const BIGTIMERFORCPUCONTROL = 15 const CPUPUSHDELAY = 30 const PUSHING = 0 const RUNNING = 1 const PANTING = 2 const STARTPUSHERX = 20 const STARTPUSHERY = 78 const ENDPUSHERX = 125 dim counter = a dim lastJoystick = b dim currentPushingFrame = c dim currentRunningFrame = d; optimize? dim currentPlayerAction = e dim temp = f dim runningEvenOdd = g dim storedColorPlayer0 = h dim storedColorPlayer1 = i dim currentPantingFrame = j; optimize? dim currentRockFrame = k dim _BitOp_01 = l dim _Bit0_Reset_Restrainer = l dim cpuControl = m dim smallJoystickTimer = n dim bigJoystickTimer = o dim cpuPushingTimer = p __Start_Restart AUDV0 = 0 : AUDV1 = 0 player1score = 0; cpuControl = 1: currentPlayerAction = PUSHING smallJoystickTimer = 0 bigJoystickTimer = 0 gosub resetPlayerPosition lastJoystick = WASCENTEREDAFTERUP currentPlayerAction = PANTING playfield: ................................ ................................ ............................XXXX .........................XXXXXXX ....................XXXXXXXXXXXX ...............XXXXXXXXXXXXXXXXX ...........XXXXXXXXXXXXX.XXXXXXX ......XXXXXXXXXXX.XXXXXXXXXXXXXX ...XXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXX.XXXXXXXXXX.XXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX end /* ..............XXXXXXXXXXXXXXXXXX ............XXXX.X...X.X...X...X ........XXXXXXX..XX..XXX..XX.X.X ....XXXXXXXXXXXX.X..XX.XXX.XX..X XXXXXXXXXXXXXXXX.X...XXX..XX..XX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */ const ABOVEMAXPUSHINGFRAME = 4 const ABOVEMAXRUNNINGFRAME = 2 currentPushingFrame = 0; const ABOVEMAXROCKFRAME = 4 gosub redoColors _Bit0_Reset_Restrainer{0} = 1 main if currentPlayerAction = RUNNING then goto doneWithTimerStuff smallJoystickTimer = smallJoystickTimer + 1 if smallJoystickTimer > 100 then smallJoystickTimer = 0: bigJoystickTimer = bigJoystickTimer + 1 if bigJoystickTimer > 100 then bigJoystickTimer = 0 ;player0score = currentPushingFrame if SWCHA<240 then smallJoystickTimer = 0 : bigJoystickTimer = 0: cpuControl = 0 if bigJoystickTimer > BIGTIMERFORCPUCONTROL then cpuControl = 1: currentPlayerAction = PUSHING doneWithTimerStuff counter = counter + 1 if counter = 60 then counter = 0: rem COLUP0 = 140 rem COLUP1 = 28 COLUP0 = storedColorPlayer0 COLUP1 = storedColorPlayer1 player0scorecolor = storedColorPlayer0 player1scorecolor = storedColorPlayer1 if currentRockFrame = 0 then player1: %00111100 %00111110 %01111110 %11111111 %11111111 %11111111 %11111111 %11111111 %11111111 %00111111 %00111100 %00000000 end if currentRockFrame = 1 then player1: %00111100 %01111110 %01111110 %11111111 %11111111 %11111111 %11111111 %11111111 %11111110 %11111100 %00111100 %00000000 end if currentRockFrame = 2 then player1: %00111100 %01111110 %01111111 %11111111 %11111111 %11111111 %11111111 %11111111 %11111111 %01111110 %00111110 %00000000 end if currentRockFrame = ABOVEMAXROCKFRAME then currentRockFrame = 0 if currentPlayerAction = RUNNING then goto setPlayerGraphicRunning if currentPlayerAction = PUSHING then goto setPlayerGraphicPushing setPlayerGraphicPanting if currentPantingFrame < HALFPANTINGFRAME then player0: %00011000 %00001000 %00010000 %00010000 %00001000 %00001100 %00001010 %00001100 %00001000 %00011000 %00111000 %00011000 end if currentPantingFrame >= HALFPANTINGFRAME then player0: %00011000 %00001000 %00010000 %00010000 %00001010 %00001010 %00001100 %00111000 %01110000 %00110000 %00000000 %00000000 end /* if currentPantingFrame >= HALFPANTINGFRAME then player0: %00011000 %00001000 %00010000 %00010000 %00001010 %00001010 %00001100 %00111000 %01110000 %00110000 %00000000 %00000000 end */ goto doneSetPlayerGraphic setPlayerGraphicPushing if currentPushingFrame = 0 then player0: %10011000 %11010000 %01001000 %00110000 %00110000 %00010000 %00011000 %00001100 %00001010 %00011001 %00011101 %00011000 end if currentPushingFrame = 1 then player0: %01101100 %01001000 %00100100 %00110100 %00011000 %00010000 %00011000 %00010100 %00110010 %00111010 %00110000 %00000000 end if currentPushingFrame = 2 then player0: %11001000 %01011000 %01011000 %00110000 %01110000 %00110000 %00010000 %00011000 %00001001 %00111001 %01110110 %00110000 end if currentPushingFrame = 3 then player0: %10110000 %10110000 %01010000 %00111000 %00001100 %00000100 %00001100 %00111001 %01110101 %00110010 %00000000 %00000000 end goto doneSetPlayerGraphic setPlayerGraphicRunning if currentRunningFrame >= HALFRUNNINGFRAME then player0: %00001100 %00000110 %00001000 %00000100 %00101100 %00011100 %00011100 %00011000 %00110000 %01110000 %00110000 %00000000 end if currentRunningFrame < HALFRUNNINGFRAME then player0: %01100000 %00100001 %00100111 %00011100 %00001000 %00101000 %01011000 %00001000 %00111101 %01110010 %00110000 %00000000 end moveWhileRunning if runningEvenOdd = 0 then player0x = player0x - 2:runningEvenOdd = 1: goto doneMoveWhileRunning runningEvenOdd = 0 player0y = player0y + 1 doneMoveWhileRunning doneSetPlayerGraphic if cpuControl = 0 then goto doHumanControlOfPushing CPUcontrolPushing if currentPlayerAction <> PUSHING then goto controlLogicRunningOrPanting cpuPushingTimer = cpuPushingTimer + 1 if cpuPushingTimer > CPUPUSHDELAY then cpuPushingTimer = 0: gosub PushItRealGood goto doneControlLogic doHumanControlOfPushing if currentPlayerAction <> PUSHING then goto controlLogicRunningOrPanting controlLogicPushing if ! joy0right then goto notright if lastJoystick <> WASCENTEREDAFTERUP then goto notright lastJoystick = WASRIGHT gosub PushItRealGood notright if ! joy0up then goto notup if lastJoystick <> WASCENTEREDAFTERRIGHT then goto notup lastJoystick = WASUP gosub PushItRealGood notup maybeJoystickIsCentered if SWCHA<240 then goto joystickMustaBeenTouched if lastJoystick = WASRIGHT then lastJoystick = WASCENTEREDAFTERRIGHT if lastJoystick = WASUP then lastJoystick = WASCENTEREDAFTERUP joystickMustaBeenTouched goto doneControlLogic controlLogicRunningOrPanting if currentPlayerAction = PANTING then goto controlLogicPanting controlLogicRunning doneMovingFromRunningFrame currentRunningFrame = currentRunningFrame + 1 if currentRunningFrame > COUNTRUNNINGFRAMES then currentRunningFrame = 0: currentRockFrame = currentRockFrame + 1 if currentRunningFrame = HALFRUNNINGFRAME then currentRockFrame = currentRockFrame + 1 if player0x < STARTPUSHERX then currentPlayerAction = PANTING: player1score = addbcd(player1score, 1): gosub redoColors: gosub resetPlayerPosition: smallJoystickTimer = 0: bigJoystickTimer = 0 goto doneControlLogic controlLogicPanting if joy0up then currentPlayerAction = PUSHING if joy0right then currentPlayerAction = PUSHING currentPantingFrame = currentPantingFrame + 1 if currentPantingFrame > COUNTPANTINGFRAMES then currentPantingFrame = 0 doneControlLogic player1x = player0x + 6 player1y = player0y - 4 drawscreen if !switchreset then _Bit0_Reset_Restrainer{0} = 0 : goto main ;``````````````````````````````````````````````````````````````` ; Jumps to beginning of main loop if the reset switch hasn't ; been released after being pressed. ; if _Bit0_Reset_Restrainer{0} then goto main ;``````````````````````````````````````````````````````````````` ; Restarts the program. ; goto __Start_Restart redoColors ;COLUBK = $00 : COLUPF = $38; COLUBK = rand COLUPF = rand storedColorPlayer0 = rand storedColorPlayer1 = rand return resetPlayerPosition player0x = STARTPUSHERX player0y = STARTPUSHERY return PushItRealGood player0x = player0x + 2 player0y = player0y - 1 currentRockFrame = currentRockFrame + 1 currentPushingFrame = currentPushingFrame + 1 if currentPushingFrame = ABOVEMAXPUSHINGFRAME then currentPushingFrame = 0 if player0x > ENDPUSHERX then currentPlayerAction = RUNNING return rem should be last lines in game inline bcd_math.asm inline playerscores.asm