dim _startgame = p _startgame = 1 const fontstyle=STOCK const fontcharSPACE=1 const fontcharBACK=1 const fontcharCROSS=1 const fontcharHEART=1 const fontcharINVIS=1 const fontcharTREE=1 playfield: ........X...............X....... ........X...............X....... ........X...............X....... ........X...............X....... ........X...............X....... ........X...............X....... ........X...............X....... ........X...............X....... ........X...............X....... ........X...............X....... ........X...............X....... end const pfscore = 1 pfscorecolor = $4A ; score vars const playerscores = 2 ; valid options are 2 or 4 only const onedigitscores = 1 player1scorecolor = $6A player0scorecolor = $00 rem extra row pfpixel 8 11 on pfpixel 24 11 on COLUBK = $50 ;$5A COLUPF = $46 ;$26 dim _a = a dim _sum = b dim _left_right = c dim _rand1 = d dim _invisible0 = e dim _invisible1 = f dim _speed = g dim _b = h dim _c = i dim _cocoside = j dim _speedup = k dim player0score = l ; Define a variable for this only if pfscore1 is used dim player1score = m ; Define a variable for this only if pfscore2 is used dim _p1loc = n dim _animate = o ;dim _startgame = p dim _multiplayer = q dim _pause = r dim _coconut = s dim _Ch0_Sound = t dim _Ch0_Duration = u dim _C0 = v dim _V0 = w dim _F0 = x dim _bleep = y dim _ballflip = z _a = 0 : _b = 0 : _c = 0 __startup _ballflip = 0 _bleep = 1 _pause = 0 _multiplayer = 1 _cocoside = %110000 if switchleftb then _multiplayer = 0 missile0x = 45 missile0y = 0 missile1x = 109 missile1y = 0 ballx = 120 bally = 198 ballheight = 4 CTRLPF = $21 _speed = 40 _left_right{1} = 1 _left_right{7} = 1 player0y = 80 : player1y = 80 _coconut = 0 if !switchrightb then _coconut = 1 pfscore1 = %01010101 : pfscore2 = %01010101 player0score = $a player1score = $a score = 0 ;main loop __main _pause = 0 if switchbw then _pause = 1 if _coconut then bally = 100 if _ballflip then ballx = ballx + 64 : _ballflip = 0 : goto __balskip ballx = ballx - 64 : _ballflip = 1 __balskip ; Draw player sprites if _animate < 3 then goto __skipanimate1 player0: %00000000 %00000000 %00000000 %00000000 %00111111 %01001100 %00101111 %00001000 end goto __skipani1 __skipanimate1 player0: %00000000 %00000000 %00000000 %00000000 %01111000 %10011111 %01011000 %00010111 end __skipani1 if _animate < 3 then goto __skipanimate2 player1: %00000000 %00000000 %00000000 %00000000 %00111111 %01001100 %00101111 %00001000 end goto __skipani2 __skipanimate2 player1: %00000000 %00000000 %00000000 %00000000 %01111000 %10011111 %01011000 %00010111 end __skipani2 gosub __sprite_color drawscreen if _pause then goto __pauseskip if _startgame then goto __startskip if switchreset then goto __startup ; speed up the tree _sum = _sum + _speed _sum = _sum + 1 if _sum > _speed then goto __skipmove _animate = _animate + 1 if _animate > 5 then _animate = 0 ; check if a new tree block needs to be made and then see if a branch should be made _rand1 = rand & 1 if !pfread(8,0) then _left_right{0} = 1 : pfpixel 8 0 8 on : pfpixel 24 0 24 on else _left_right{0} = 0 if _left_right{0} && !_rand1 then gosub __branch missile0y = missile0y + 1 missile1y = missile1y + 1 bally = bally + 2 pfscroll down __skipmove ;delete all branches on players side if collision(player0, playfield) then pfscore1 = pfscore1/4 : _Ch0_Sound = 1 : _Ch0_Duration = 30 : _V0 = 12 : _bleep = 0: gosub __killbranch1 if collision(player1, playfield) then pfscore2 = pfscore2/4 : _Ch0_Sound = 1 : _Ch0_Duration = 30 : _V0 = 12 : _bleep = 0: gosub __killbranch2 if collision(player0, ball) then pfscore1 = pfscore1/4 : _Ch0_Sound = 1 : _Ch0_Duration = 30 : _V0 = 12 : _bleep = 0: gosub __killbranch1 if collision(player1, ball) then pfscore2 = pfscore2/4 : _Ch0_Sound = 1 : _Ch0_Duration = 30 : _V0 = 12 : _bleep = 0: gosub __killbranch2 rem functions for bonus gosub __sprite_color if collision(player0, missile0) then drawscreen : gosub __score1up : missile0y = 160 : missile1y = 160 : _Ch0_Sound = 3 : _Ch0_Duration = 25 : _F0 = 31 : _bleep =0 if collision(player1, missile1) then drawscreen : gosub __score2up : missile0y = 160 : missile1y = 160 : _Ch0_Sound = 3 : _Ch0_Duration = 25 : _F0 = 31 : _bleep =0 if collision(missile0, playfield) then missile0y = 0 if collision(missile1, playfield) then missile1y = 0 if !pfscore1 then goto __gameover if !pfscore2 then goto __gameover rem delete bonus if missile0y > 200 then missile0y = 0 : missile1y = 0 : gosub __randmis rem ball temp1 = (rand & 3) if bally > 200 && !temp1 then bally = 0 : missile0y = 160 : missile1y = 160 : _Ch0_Sound = 5 : _Ch0_Duration = 25 : _F0 = 31 : _bleep =0 if bally > 200 then bally = 100 : gosub __randcoco rem use bonus if !joy0fire then goto __skipfire if joy0fire && player0score > $a then _Ch0_Sound = 4 : _Ch0_Duration = 32 : _C0 = 4 : _V0 = 12 : _F0 = 31 : _bleep = 0 if joy0fire && player0score = $b then _speed = _speed -20 : _speedup = 0 : player0score = $a if joy0fire && player0score = $c then gosub __killbranch1 if joy0fire && player0score = $d then gosub __livesplus1 if joy0fire && player0score = $e then player0score = $a : _invisible0 = 1 if joy0fire && player0score = $f then player0score = $a : gosub __mkbranch1 __skipfire rem use bonus if !joy1fire then goto __skipfire2 if joy1fire && player1score > $a then _Ch0_Sound = 4 : _Ch0_Duration = 32 : _C0 = 4 : _V0 = 12 : _F0 = 31 : _bleep = 0 if joy1fire && player1score = $b then _speed = _speed -20 : _speedup = 0 : player1score = $a if joy1fire && player1score = $c then gosub __killbranch2 if joy1fire && player1score = $d then gosub __livesplus2 if joy1fire && player1score = $e then player1score = $a : _invisible1 = 1 if joy1fire && player1score = $f then player1score = $a : gosub __mkbranch2 __skipfire2 rem controls if joy0left then _left_right{4} = 1 if joy0right then _left_right{4} = 0 if joy0up && player0y > 10 then player0y = player0y - 1 if joy0down && player0y < 85 then player0y = player0y + 1 if joy1left then _left_right{5} = 1 if joy1right then _left_right{5} = 0 if joy1up && player0y > 10 then player1y = player1y - 1 if joy1down && player1y < 85 then player1y = player1y + 1 rem speed up climbing rem raise score and remove bottom layer if pfread(8,11) then _speedup = _speedup + 1 : gosub __sprite_color : drawscreen : pfhline 4 11 8 off : pfhline 20 11 24 off : gosub __sprite_color : drawscreen : pfhline 8 11 13 off : pfhline 25 11 28 off : score = score + 1 : gosub __bleep if _speedup > 1 then _speed = _speed + 1 : _speedup = 0 if _speed > 250 then _speed = 250 __startskip __pauseskip if joy0fire && _startgame then _startgame = 0 : _invisible0 =0 : _invisible1=0 : goto __startup if switchreset && _startgame then _startgame = 0 : _invisible0 =0 : _invisible1=0 : goto __startup if _startgame then gosub __scorehs ; sound _Ch0_Duration = _Ch0_Duration - 1 if !_Ch0_Duration then goto __Clear_Ch_0 if _Ch0_Sound <> 1 then goto __Skip_Ch0_Sound_001 AUDC0 = 8 : AUDV0 = _V0 : AUDF0 = 19 temp5 = _Ch0_Duration & %00000001 if temp5 && _V0 then _V0 = _V0 - 1 goto __Skip_Ch_0 __Skip_Ch0_Sound_001 if _Ch0_Sound <> 2 then goto __Skip_Ch0_Sound_002 AUDC0 = 4 : AUDV0 = _V0 : AUDF0 = 19 temp5 = _Ch0_Duration & %00000001 if temp5 && _V0 then _V0 = _V0 - 1 goto __Skip_Ch_0 __Skip_Ch0_Sound_002 if _Ch0_Sound <> 3 then goto __Skip_Ch0_Sound_003 AUDC0 = 4 : AUDV0 = 8 : AUDF0 = _F0 _F0 = _F0 - 1 goto __Skip_Ch_0 __Skip_Ch0_Sound_003 if _Ch0_Sound <> 4 then goto __Skip_Ch0_Sound_004 AUDC0 = _C0 : AUDV0 = _V0 : AUDF0 = _F0 _C0 = _C0 ^ 8 temp5 = _Ch0_Duration & %00000001 if temp5 && _V0 then _V0 = _V0 - 1 if _F0 then _F0 = _F0 - 1 goto __Skip_Ch_0 __Skip_Ch0_Sound_004 if _Ch0_Sound <> 5 then goto __Skip_Ch0_Sound_005 AUDC0 = 8 : AUDV0 = 8 : AUDF0 = _F0 _F0 = _F0 - 1 goto __Skip_Ch_0 __Skip_Ch0_Sound_005 ; stop sound goto __Skip_Ch_0 __Clear_Ch_0 _Ch0_Sound = 0 : AUDV0 = 0 : _bleep = 1 __Skip_Ch_0 goto __main __branch ;make if pfread(9,0) then return if pfread(7,0) then return if (rand & 1) then goto __left if !pfread(9,1) then pfhline 4 0 7 on : pfhline 20 0 23 on return __left if !pfread(7,1) then pfhline 9 0 12 on : pfhline 25 0 28 on return __killbranch1 if _left_right{4} then pfvline 7 0 11 off : pfvline 6 0 11 off : gosub __sprite_color : drawscreen : pfvline 5 0 11 off : pfvline 4 0 11 off : gosub __sprite_color : drawscreen : bally = 100 if !_left_right{4} then pfvline 9 0 11 off : pfvline 10 0 11 off : gosub __sprite_color : drawscreen : pfvline 11 0 11 off : pfvline 12 0 11 off : gosub __sprite_color : drawscreen : bally = 100 player0score = $a return __killbranch2 if _left_right{5} then pfvline 23 0 11 off : pfvline 22 0 11 off : gosub __sprite_color : drawscreen : pfvline 21 0 11 off : pfvline 20 0 11 off : gosub __sprite_color : drawscreen : bally = 100 if !_left_right{5} then pfvline 25 0 11 off : pfvline 26 0 11 off : gosub __sprite_color : drawscreen : pfvline 27 0 11 off : pfvline 28 0 11 off : gosub __sprite_color : drawscreen : bally = 100 player1score = $a return __sprite_color COLUBK = $C4 ;$5A COLUPF = $26 ;$26 COLUP0 = $4A ;$6C COLUP1 = $9A ;$BC if _startgame || _pause then COLUP1 = $0C : COLUP0 = $0C if _multiplayer then COLUP1 = $C4 ; location of players + switch mechanics if _left_right{4} then player0x = 41 else player0x = 53 : REFP0 = 8 if _left_right{5} then player1x = 105 else player1x = 117 : REFP1 = 8 if _multiplayer then player1x = 180 NUSIZ0=$10 missile0height = 1 NUSIZ1 =$10 missile1height = 1 if _startgame then return ;Check if player is invisible if _invisible0 then _invisible0 = _invisible0 + 1 : COLUP1 = $C4 if _invisible0 = 200 then _invisible0 = 0 if _invisible1 then _invisible1 = _invisible1 + 1 : COLUP0 = $C4 if _invisible1 = 200 then _invisible1 = 0 return __mkbranch1 _p1loc = (player0y - 1) / 8 pfhline 20 _p1loc 23 on return __mkbranch2 _p1loc = (player1y - 1) / 8 pfhline 9 _p1loc 12 on return __gameover if _startgame then goto __main _startgame = 1 temp1 = score temp2 = score+1 temp3 = score+2 if temp1 > _a then goto __New_High_Score if temp1 < _a then goto __Skip_High_Score if temp2 > _b then goto __New_High_Score if temp2 < _b then goto __Skip_High_Score if temp3 > _c then goto __New_High_Score if temp3 < _c then goto __Skip_High_Score goto __Skip_High_Score __New_High_Score _a = temp1 : _b = temp2 : _c = temp3 __Skip_High_Score _startgame = 2 goto __main __bleep if _bleep then _Ch0_Sound = 2 : _Ch0_Duration = 30 : _V0 = 2 return __livesplus1 if pfscore1 = %01010101 then return pfscore1 = pfscore1 * 4|1 : player0score = $a return __livesplus2 if pfscore2 = %01010101 then return pfscore2 = pfscore2 * 4|1 : player1score = $a return __score1up if player0score < $f then player0score = player0score + 1 return __score2up if player1score < $f then player1score = player1score + 1 return __randcoco _ballflip = 0 if (rand & 1) then ballx = 120 else ballx = 108 return __randmis if (rand & 1) then missile0x = 46 : missile1x = 110 else missile0x = 57 : missile1x = 121 return __scorehs if !_startgame then goto __main ;reuse invisible var to flip HS back & forth _invisible0 = _invisible0 + 1 if _invisible0 > 200 then _invisible0 = 0 temp4 = score temp5 = score+1 temp6 = score+2 if _invisible0 < 100 then scorecolor = $44 if _invisible0 = 100 then _rand1=temp4 : _invisible1=temp5 : _speed=temp6 : temp4 = _a : temp5 = _b : temp6 = _c if _invisible0 > 100 && _invisible0 < 199 then scorecolor = $66 if _invisible0 = 200 then temp4 = _rand1 : temp5 = _invisible1 : temp6 = _speed return goto __main inline playerscores.asm