'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ '~ Ping By Gareth Bailey: october 2001 ~ '~ ~ '~======================================================== ~ '~ UP/DOWN to move the paddles ~ '~ This game is for 2 players ~ '~ ~ '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ open window 640,512 setup():main() sub setup() score=0 padspd=5 x=320 y=220 dirx=-5 by =185 by2=by end sub sub main() draw() xtoplay() repeat clear window draw() conread() col() db() until (peek("port1")=4096) end sub sub conread() con = peek("port1") if (and(con,16) <> 0) by =by -padspd if (and(con,64) <> 0) by =by +padspd con2= peek("port2") if (and(con2,16) <> 0) by2=by2-padspd if (and(con2,64) <> 0) by2=by2+padspd end sub sub col() x=x-dirx:y=y-diry if x<20 or x>620 then if x>620 score =score +1 if x<20 score2=score2+1 xtoplay() fi if y<20 or y>410 diry=0-diry if y>by and y30 dirx=0-dirx if y>by2 and y600 dirx=0-dirx if by>350 by=350 if by<20 by=20 if by2>350 by2=350 if by2<20 by2=20 end sub sub db() setdispbuf draw draw = 1 - draw setdrawbuf 1-draw end sub sub draw() rectangle 20,20 to 630,420 fill rectangle 30,by to 40,by+70 fill rectangle 620,by2 to 610,by2+70 fill rectangle x,y to x+10,y+10 text 100,450,"player(1): "+str$(score ),"lc" text 540,450,"player(2): "+str$(score2),"rc" text 320,475,"Press /\ to exit","cc" end sub sub xtoplay() text 320,220,"PRESS 'X' TO CONTINUE","cc" x=320:y=220 diry=ran(6)+1 repeat:until (peek("port1")=16384) end sub