Heyas,
Here's some code I'm playing with... Bet you can't guess what it is *8)
Anyway can someone point me in the right direction, whats the simplest way to detect a collision between paddles, and shoot it off on an angle?
Here's some code I'm playing with... Bet you can't guess what it is *8)
Anyway can someone point me in the right direction, whats the simplest way to detect a collision between paddles, and shoot it off on an angle?
Graphics 640, 480, 0, 2 SetBuffer BackBuffer() ; Initialize and center paddles. Global PaddleY1 = 190 Global PaddleY2 = 190 ; Initialize and center ball. Global BallPosX = 317 Global BallPosY = 237 While Not KeyDown(1) Cls ProcessPaddle1() ProcessPaddle2() ProcessBall() Flip Wend Function ProcessBall() BallPosX = BallPosX + 1 Rect BallPosX, BallPosY, 6, 6 End Function Function ProcessPaddle1() If KeyDown(30) PaddleY1 = PaddleY1 - 2 ElseIf KeyDown(44) PaddleY1 = PaddleY1 + 2 EndIf If PaddleY1 < 0 Then PaddleY1 = 0 If PaddleY1 > 380 Then PaddleY1 = 380 Rect 10, PaddleY1, 10, 100, 1 End Function Function ProcessPaddle2() If KeyDown(200) PaddleY2 = PaddleY2 - 2 ElseIf KeyDown(208) PaddleY2 = PaddleY2 + 2 EndIf If PaddleY2 < 0 Then PaddleY2 = 0 If PaddleY2 > 380 Then PaddleY2 = 380 Rect 620, PaddleY2, 10, 100, 1 End Function