Randomize Timer() : set display mode 640,480,32 : circle 5,5,5 : GET IMAGE 1, 0,0,12,12 : Sprite 1,0,0,1 : CLS : Backdrop on : Color Backdrop RGB(0,0,0)
Global x,y,P1SC,P2SC,P1PP,P2PP : x = 100 : y = 200 : vx = 2 : vy = 1 : xdir = 1 : ydir = 1 : P1PP = 250 : P2PP = 250 rem player 1 & 2 paddle position
Set Text Font "Aerial" : Set Text Size 40 : Set Text To Bold
Do
While x>0 and x<640
x=x+vx*xdir:y=y+vy*ydir rem update ball position
If shiftkey() Then Dec P1PP,3 : If P1PP < 85 Then P1PP = 85
If controlkey() Then Inc P1PP,3 : If P1PP > 415 Then P1PP = 415
If upkey() Then Dec P2PP,3 : If P2PP < 85 Then P2PP = 85
If downkey() Then Inc P2PP,3 : If P2PP > 415 Then P2PP = 415
Gosub Drawscreen
EndWhile
IF X < 010 THEN INC P2SC ELSE INC P1SC rem process the score
Gosub Drawscreen : x = rnd(400)+120 : y = rnd(300)+100 : xdir=-xdir
LOOP
Drawscreen:
t$ = "Player1: "+str$(P1SC)+" Player 2: "+str$(P2SC) : TEXT 100,25,t$ : Box 0,80,5,180 : Box 0,380,5,480 : Box 635,80,640,180 : Box 635,380,640,480 : Box 0,80,640,85 : Box 0,475,640,480 : Box 40,P1PP,50,P1PP+60 : Box 590,P2PP,600,P2PP+60
paste sprite 1,x,y : If Point(x-2,y)<>0 or Point(x+12,y)<>0 then xdir = -xdir : vx = rnd(2)+1
If Point(x,y-2)<>0 or Point(x,y+12)<>0 then ydir = -ydir : vx = rnd(2)+1
winapi sleep 10 : Return
A couple of days ago, I saw some comment about a pong type game and it occurred to me this might be something I could try as a 20 line challenge. My game play is based, to the best of my recollection, on Colecovision's "Telstar Tennis" circa 1976 or so. The only function that not DBPro is the "WinAPI Sleep" command. You can change it to "Wait 10" for the same basic effect.
The answer to Life, the Universe, and Everything? "Tea for Two". Deep Thought was Dyslexic.