Using POINT is not advisable, as it is much too slow. Using what is referred to as 'box' collision is usually good enough for most games I have found. I'll take a look at it and get back to you soon.
EDIT: okay, I have made some changes that I hope will help you understand things. First, here is the revised code:
Rem Basic display settings
Sync On
sync rate 60
set display mode 800,600,32
randomize timer() : ` pick a random seed so we can ontain random numbers when needed
hide mouse
ScrWid = 800 : ScrHgt = 599 : Court = 1
MaxDown = ScrHgt - 129
Rem Position Variables
Rem Paddel 1 (Human 1) position
P1X1 = 25
` P1X2 = 50
P1Y1 = 225
` P1Y2 = 350
Rem Paddel 2 (Human 2 or CPU) position
P2X1 = 775
` P2X2 = 750
P2Y1 = 225
` P2Y2 = 350
Rem Ball position and Speed
BX1 = 390
` BX2 = 410
BY1 = 310
` BY2 = 290
BSX = 3 : BallSpeedX = BSX
BSY = 3 : BallSpeedY = BSY
MissedIt = 0
Rem Scores
dim score(2)
Score(1) = 0 : Score(2) = 0
gosub MakeCourtImage
FirstTime = 1
gosub Restart
FirstTime = 0
DO
`CLS
paste image Court,0,0
gosub DrawPaddlesBall
gosub DisplayScores
Rem Score Counter
If BX1 < (P1X1 - 20) : ` player 1 missed it
Score(2) = Score(2) + 1
MissedIt = 1
` BX1 = 390
` BX2 = 410
` BY1 = 310
` BY2 = 290
Endif
If BX1 >= (P2X1 + 20) : ` player 2 missed it
Score(1) = Score(1) + 1
MissedIt = 1
` BX1 = 390
` BX2 = 410
` BY1 = 310
` BY2 = 290
Endif
rem check to see if the ball hit one of the player's paddles'
if BX1 >= (P1X1 - 10) and BX1 <= (P1X1 + 25): ` allow up to half of the ball to get into the paddle
if BY1 >= (P1Y1 - 10) and BY1 <= (P1Y1 + 135)
BSX = BallSpeedX : ` change ball direction
endif
endif
if BX1 >= (P2X1 - 20) and BX1 <= (P2X1 + 15): ` allow up to half of the ball to get into the paddle
if BY1 >= (P2Y1 - 10) and BY1 <= (P2Y1 + 135)
BSX = -BallSpeedX : ` change ball direction
endif
endif
Rem Paddel 1 Movement
Rem Up (Duh)
If Upkey() = 1 AND P1Y1 > 4
Dec P1Y1,4
` Dec P1Y2,4
EndIf
Rem Paddel and Ball Collision
` If P1Y1 <= 4
` P1X1 = 25
` P1X2 = 50
` P1Y1 = 1
` P1Y2 = 126
` Endif
Rem Down (duh)
If Downkey() = 1 and P1Y1 < MaxDown
Inc P1Y1,4
EndIf
Rem Paddel 2 Movement
Rem Up
If Keystate(17) = 1 and P2Y1 > 4 ` W
Dec P2Y1,4
` Dec P2Y2,4
EndIf
Rem Down
If Keystate(31) = 1 AND P2Y1 < MaxDown : ` S
Inc P2Y1,4
` Inc P2Y2,4
EndIf
Rem Ball Movement
Inc BX1,BSX
Inc BY1,BSY
if BY1 < 4 or BY1 > (ScrHgt - 24) then BSY = BSY * -1
sync
if MissedIt = 1 then Gosub Restart
Loop
end
DisplayScores:
Rem Score Keeper
Set Text Size 36
ink rgb(0,0,255),0 : ` blue
Text 600,0,"SCORE2: " + STR$(Score(2))
ink rgb(255,0,0),0 : ` red
Text 200,0,"SCORE1: " + STR$(Score(1))
return
MakeCourtImage:
ink rgb(255,255,255),0 : ` white
Rem Court
Line 0,0,799,0
Line 0,0,0,599
Line 0,599,799,599
Line 799,0,799,599
Line 400,0,400,599
Circle 400,300,50
get image Court,0,0,ScrWid,ScrHgt
return
DrawPaddlesBall:
Rem Paddel 1 (Human 1)
Box P1X1,P1Y1,P1X1 + 25,P1Y1 + 125,RGB(255,0,0),RGB(255,0,0),RGB(255,0,0),RGB(255,0,0)
Rem Paddel 2 (Human 2 or CPU(maybe))
Box P2X1,P2Y1,P2X1 + 25,P2Y1 + 125,RGB(0,0,255),RGB(0,0,255),RGB(0,0,255),RGB(0,0,255)
Rem Ball
Box BX1,BY1,BX1 + 20,BY1 + 20,RGB(0,255,0),RGB(0,255,0),RGB(0,255,0),RGB(0,255,0)
return
rem use a subroutine to restart the game after one of the players misses the ball
Restart:
` pick random direction for the ball to move
direction = rnd(3) : ` direction will hold a value between 0 and 3
` SELECT and CASE statements to determine the value of direction
select direction
case 0 : ` up and right
BSX = BallSpeedX
BSY = -BallSpeedY
endcase
case 1 : ` down and right
BSX = BallSpeedX
BSY = BallSpeedY
endcase
case 2 : ` down and left
BSX = -BallSpeedX
BSY = BallSpeedY
endcase
case 3 : ` up and left
BSX = -BallSpeedX
BSY = -BallSpeedY
endcase
endselect
` reset the ball's X/Y coordinates
BX1 = (ScrWid / 2) - 10
BY1 = (ScrHgt / 2) - 10
` display everything while waiting for someone to press a key
repeat
paste image Court,0,0
gosub DrawPaddlesBall
gosub DisplayScores
ink rgb(255,255,0),0
a$ = "Press any key to play again."
if FirstTime = 1 then a$ = "Press any key to start the game."
center text ScrWid / 2,100,a$
sync
until scancode() > 0
MissedIt = 0
return
This introduces you to a few new things; randomizing, arrays, subroutines, select/case and grabbing a screen image.
You will notice that the CLS is no longer needed. The reason for this is that the entire screen is grabbed as an image after the court is drawn. This image is pasted every loop onto the screen, in effect wiping out whatever was there previously. You could use this same technique to grab images of the ball and paddles. Instead of drawing them every game loop, you would simply paste the image at that location.
The scores are now held in an array. Arrays are handy for organizing things. You could store the player's X/Y coordinates in an array, the ball coordinates can be held in an array, etc.
Subroutines are used for code that gets repeated many times. By placing specific tasks into a subroutine, it makes your code easier to read, follow and debug (fix errors that come up). I did not put everything into a subroutine that I normally would have, as I left that for you. Some suggestions: UserInput, MoveBall and CheckPaddles. Normally, your main DO - LOOP consists of jumps to subroutines (or functions) and is normally very compact. Again, structuring your code like this will help you keep organized.
So many games to code.......so little time.