rem Generated 7/14/2017 2:23:38 PM by Visual bB Version 1.0.0.554 rem ********************************** rem * * rem * * rem * * rem * * rem * * rem ********************************** set kernel_options pfheights pfcolors _game_start dim p0_x = b dim p0_y = c dim p1_x = d dim p1_y = e rem ball velocity variables dim bvx = f dim bvy = g bvx = 0 bvy = 0 rem ball velocity decrementer variables dim bdx = h dim bdy = i dim pbx = l dim pby = m dim pfc = n pfc = 24 o = 0 dim boolean = o def xClip = boolean{0} def yClip = boolean{1} def xyClip = boolean{2} def bMoveRt = boolean{3} def bMoveLf = boolean{4} def bMoveUp = boolean{5} def bMoveDn = boolean{6} def bCollsn = boolean{7} p = 0 dim boolean1 = p def p0_mv_Lf = boolean1{0} def p0_mv_Rt = boolean1{1} def p0_mv_Up = boolean1{2} def p0_mv_Dn = boolean1{3} def p1_mv_Lf = boolean1{4} def p1_mv_Rt = boolean1{5} def p1_mv_Up = boolean1{6} def p1_mv_Dn = boolean1{7} dim tmp = j dim scoring = k const scoreTime = 60 scoring = 61 rem scoring < 61 == state for just scored rem scoring == 61 == gameplay state rem 62 <= scoring <= 122 == red win state rem 123 <= scoring <= 183 == blu win state const topPf = 26 const botPf = 70 const leftPf = 28 const rightPf = 126 const redMid = 60 const bluMid = 94 const goal_ceil = 38 const goal_floor = 52 dim scback = x scback = $00 const p_start_y = 48 const p0_strt_x = 28 const p1_strt_x = 126 player0x = p0_strt_x player0y = p_start_y missile0height = 5 missile0x = 61 missile0y = 92 player1x = p1_strt_x player1y = p_start_y missile1height = 5 missile1x = 63 missile1y = 92 const b_red_strt_x = 54 const b_blu_strt_x = 106 const b_start_y = 45 ballx = b_red_strt_x bally = b_start_y ballheight = 3 ; ball is 3 px tall by 4 px wide because THE PIXELS ARE TOO DAMN TALL! default player0: %00111100 %01111110 %11100111 %11011011 %11011011 %11100111 %01111110 %00111100 end player1: %00111100 %01111110 %11100111 %11011011 %11011011 %11100111 %01111110 %00111100 end AUDC0 = 15 AUDF0 = 31 AUDC1 = 8 AUDF1 = 18 AUDV1 = 0 score = 012345 scorecolor = 14 CTRLPF = $23 pfheights: 1 13 22 4 4 1 3 4 22 12 1 end pfcolors: 24 24 24 24 24 24 24 24 24 24 24 end playfield: ................................ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX X..............................X ................................ ................................ ................................ ................................ ................................ X..............................X XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ................................ end main PF0 = %11110000 COLUBK = 14 COLUP0 = 66 COLUP1 = 130 AUDV0 = 3 NUSIZ1= $10 NUSIZ0 = $10 if switchbw then AUDV0 = 0 : AUDV1 = 0 : goto _draw_screen if switchreset then goto _game_start if scoring <> 61 then goto _skip_controls rem ------------------------ rem CONTROLS rem ------------------------ p0_mv_Lf = 0 p0_mv_Rt = 0 p0_mv_Up = 0 p0_mv_Dn = 0 p1_mv_Lf = 0 p1_mv_Rt = 0 p1_mv_Up = 0 p1_mv_Dn = 0 rem pause game for 1 frame on ball collision with paddle to increase juice ;if bCollsn then bCollsn = 0 : goto _draw_screen rem Player 0 movement p0_x = 0 if joy0left then if player0x > leftPf then p0_mv_Lf = 1 : p0_mv_Rt = 0 ;p0_x = 255 if joy0right then if player0x < redMid then p0_mv_Lf = 0 : p0_mv_Rt = 1 ;p0_x = 1 if p0_mv_Lf || p0_mv_Rt then p0_x = 1 p0_y = 0 if joy0up then if player0y > topPf then p0_mv_Up = 1 : p0_mv_Dn = 0 ;p0_y = 255 if joy0down then if player0y < botPf then p0_mv_Up = 0 : p0_mv_Dn = 1 ;p0_y = 1 if p0_mv_Up || p0_mv_Dn then p0_y = 1 if joy0fire then p0_x = p0_x + p0_x : p0_y = p0_y + p0_y if p0_mv_Lf then player0x = player0x - p0_x if p0_mv_Rt then player0x = player0x + p0_x if p0_mv_Up then player0y = player0y - p0_y if p0_mv_Dn then player0y = player0y + p0_y if player0y < topPf then player0y = topPf if player0y > botPf then player0y = botPf if player0x < leftPf then player0x = leftPf if player0x > redMid then player0x = redMid rem Player 1 movement p1_x = 0 if joy1left then if player1x > bluMid then p1_mv_Lf = 1 : p1_mv_Rt = 0 ;p1_x = 255 if joy1right then if player1x < rightPf then p1_mv_Lf = 0 : p1_mv_Rt = 1 ;p1_x = 1 if p1_mv_Lf || p1_mv_Rt then p1_x = 1 p1_y = 0 if joy1up then if player1y > topPf then p1_mv_Up = 1 : p1_mv_Dn = 0 ;p1_y = 255 if joy1down then if player1y < botPf then p1_mv_Up = 0 : p1_mv_Dn = 1 ;p1_y = 1 if p1_mv_Up || p1_mv_Dn then p1_y = 1 if joy1fire then p1_x = p1_x + p1_x : p1_y = p1_y + p1_y if p1_mv_Lf then player1x = player1x - p1_x if p1_mv_Rt then player1x = player1x + p1_x if p1_mv_Up then player1y = player1y - p1_y if p1_mv_Dn then player1y = player1y + p1_y ;player1x = player1x + p1_x ;player1y = player1y + p1_y if player1y < topPf then player1y = topPf if player1y > botPf then player1y = botPf if player1x < bluMid then player1x = bluMid if player1x > rightPf then player1x = rightPf _skip_controls if scoring >= 61 then AUDV1 = 0 rem ------------------------ rem collision rem ------------------------ rem ----RED PADDLE COLLISION---- if !collision(player0,ball) || bCollsn then goto _skip_P0_B_col AUDF1 = 4 - bvy AUDV1 = 15 bCollsn = 1 tmp = 0 if ballx > player0x - 3 && ballx < player0x + 7 then xClip = 1 if bally > player0y - 3 && bally < player0y + 7 then yClip = 1 if xClip && yClip then xyClip = 1 _skip_ball_knock_back rem if the player isn't moving, reverse movement, otherwise copy its direction if bMoveLf then bMoveRt = 1 : bMoveLf = 0 : goto _skip_to_b_p0_vmotn if bMoveRt then bMoveRt = 0 : bMoveLf = 1 _skip_to_b_p0_vmotn if bMoveUp then bMoveUp = 0 : bMoveDn = 1 : goto _skip_b_rev_p0 if bMoveDn then bMoveUp = 1 : bMoveDn = 0 _skip_b_rev_p0 if p0_mv_Lf = 0 && p0_mv_Rt = 0 then goto _skip_to_p0_yCol if bMoveRt && p0_mv_Rt then goto _skip_to_p0_yCol if bMoveLf && p0_mv_Lf then goto _skip_to_p0_yCol bMoveLf = p0_mv_Lf : bMoveRt = p0_mv_Rt _skip_to_p0_yCol if p0_mv_Up = 0 && p0_mv_Dn = 0 then goto _skip_to_bVel_accumulation if bMoveUp && p0_mv_Up then goto _skip_to_bVel_accumulation if bMoveDn && p0_mv_Dn then goto _skip_to_bVel_accumulation bMoveUp = p0_mv_Up : bMoveDn = p0_mv_Dn ;if temp6 > 0 then goto _skip_b_rev_p0 _skip_to_bVel_accumulation bvx = bvx + p0_x + p0_x bvy = bvy + p0_y + p0_y ;bdx = 8 _skip_P0_B_col rem ----BLU PADDLE COLLSION--- if !collision(player1,ball) || bCollsn then goto _skip_P1_B_col AUDF1 = 4 - bvy AUDV1 = 15 bCollsn = 1 if p1_x > 0 || p1_y > 0 then bMoveLf = p1_mv_Lf : bMoveRt = p1_mv_Rt : bMoveUp = p1_mv_Up : bMoveDn = p1_mv_Dn : goto _skip_b_rev_p1 if bMoveLf then bMoveRt = 1 : bMoveLf = 0 : goto _skip_to_b_p1_vmotn if bMoveRt then bMoveRt = 0 : bMoveLf = 1 _skip_to_b_p1_vmotn if bMoveUp then bMoveUp = 0 : bMoveDn = 1 if bMoveDn then bMoveUp = 1 : bMoveDn = 0 : goto _skip_b_rev_p1 _skip_b_rev_p1 bvx = bvx + p1_x + p1_x bvy = bvy + p1_y + p1_y ;bdy = 8 _skip_P1_B_col if bvx <> 0 then bdx = bdx + 1 if bvy <> 0 then bdy = bdy + 1 if bvx > 4 then bvx = 4 if bvx < 0 then bvx = 0 if bvy > 4 then bvy = 4 if bvy < 0 then bvy = 0 if scoring <> 61 then _skip_ball_movment pbx = ballx if bMoveLf then ballx = ballx - bvx if bMoveRt then ballx = ballx + bvx pby = bally if bMoveUp then bally = bally - bvy if bMoveDn then bally = bally + bvy _skip_ball_movment rem ------------------------ rem SCORE STATE rem ------------------------ if scoring >= 61 then goto _skip_score_state scoring = scoring + 1 AUDC1 = 7 AUDF1 = 8 AUDV1 = 13 if scoring < 59 then goto _skip_score_state bvx = 0 bvy = 0 player0x = p0_strt_x player0y = p_start_y player1x = p1_strt_x player1y = p_start_y if ballx <= 16 then ballx = b_blu_strt_x if ballx >= 144 then ballx = b_red_strt_x bCollsn = 0 bally = b_start_y AUDC1 = 8 AUDV1 = 0 _skip_score_state rem ------------------------- rem WIN STATE rem ------------------------- ; so this state is supposed to increment the scoring variable 60 times, ; then cycle to the pfc colors next luminance value in the corresponding ; red_win o r blu_win subroutine, but doesn't for some reason ;goto _skip_win_state if scoring < 62 then goto _skip_win_state AUDV0 = 0 AUDV1 = 0 scoring = scoring + 1 COLUBK = pfc if missile0x > 110 then gosub red_win if missile1x > 110 then gosub blu_win _skip_win_state if bCollsn then if ballx > 68 && ballx < 90 then bCollsn = 0 if bCollsn then if bvx = 0 && bvy = 0 then bCollsn = 0 if bally > 16 then goto _skip_B_bounce0_y AUDF1 = 4 - bvy AUDV1 = 15 bCollsn = 0 bMoveDn = 1 bMoveUp = 0 bally = 16 if bvy > 1 then bvy = bvy - 1 _skip_B_bounce0_y if bally < 75 then goto _skip_B_bounce1_y AUDF1 = 4 - bvy AUDV1 = 15 bCollsn = 0 bMoveDn = 0 bMoveUp = 1 bally = 74 if bvy > 1 then bvy = bvy - 1 _skip_B_bounce1_y if ballx > 21 then goto _skip_B_bounce0_x if bally > goal_ceil && bally < goal_floor then goto _skip_B_bounce0_x AUDF1 = 4 - bvx AUDV1 = 15 bCollsn = 0 bMoveLf = 0 bMoveRt = 1 ballx = 21 if bvx > 1 then bvx = bvx - 1 _skip_B_bounce0_x if ballx < 138 then goto _skip_B_bounce1_x if bally > goal_ceil && bally < goal_floor then goto _skip_B_bounce1_x AUDF1 = 4 - bvx AUDV1 = 15 bCollsn = 0 bMoveLf = 1 bMoveRt = 0 ballx = 137 if bvx > 1 then bvx = bvx - 1 _skip_B_bounce1_x rem ------------------------ rem SCORE HANDLING rem ------------------------ if ballx > 16 || scoring < 61 then goto _skip_score_blu scoring = 0 if missile1x + 5 < 110 then missile1x = missile1x + 5 : goto _skip_score_blu ; CTRLPF = $21 pfc = 148 scoring = 123 _skip_score_blu if ballx < 144 || scoring < 61 then goto _skip_score_red scoring = 0 if missile0x + 5 < 110 then missile0x = missile0x + 5 : goto _skip_score_red ; CTRLPF = $21 pfc = 68 scoring = 62 _skip_score_red ; gosub titledrawscreen bank2 _draw_screen drawscreen ; if player0x > 60 then gosub knock_player_back ; if player0x < 24 then gosub knock_player_back ; if player0y < 31 then gosub knock_player_back ; if player0y > 83 then gosub knock_player_back ; ; if player1x > 130 then gosub knock_playertwo_back ; if player1x < 94 then gosub knock_playertwo_back ; if player1y < 31 then gosub knock_playertwo_back ; if player1y > 83 then gosub knock_playertwo_back goto main red_win if scoring > 122 then scoring = 62 : pfc = pfc + 2 if pfc > 78 then pfc = 64 return blu_win if scoring > 182 then scoring = 123 : pfc = pfc + 2 if pfc > 158 then pfc = 144 return knock_player_back player0x = player0x - p0_x player0y = player0y - p0_y return knock_playertwo_back player1x = player1x - p1_x player1y = player1y - p1_y return asm minikernel sta WSYNC lda scback sta COLUBK rts end ; bank 2 ; asm ; include "titlescreen/asm/titlescreen.asm" ;end ; return