I'm currently working on a Pong clone game that I have many great ideas for. At the moment though I'm having problems with the AI paddle not stopping at the top of the screen. I've used this same code to stop sprites from moving off the screen before so I'm kinda baffled at what's going on. Below is the function that is supposed to be stopping the paddle. The paddle will stop at the bottom of the screen, but, for some odd reason when it hits the top of the screen it reappears at the bottom. I've also included the link to my game so you can see better what's happening.
FUNCTION MoveAIPaddle()
CenterOfPaddle = PaddleTwoY + (SPRITE HEIGHT(PaddleTwoSprite) / 2) ` CENTER OF THE PADDLE Y-AXIS
BottomOfScreen = SCREEN HEIGHT() - SPRITE HEIGHT(PaddleTwoSprite) ` AS FAR AS THE PADDLE CAN GO DOWN
IF CenterOfPaddle < BallY THEN INC PaddleTwoY, PaddleTwoSpeed ` PADDLE IS HIGHER THAN BALL - MOVE DOWN
IF PaddleTwoY > BottomOfScreen THEN PaddleTwoY = BottomOfScreen ` BOTTOM OF SCREEN
IF CenterOfPaddle > BallY THEN DEC PaddleTwoY, PaddleTwoSpeed ` PADDLE IS LOWER THAN BALL - MOVE UP
IF PaddleTwoY < 0 THEN PaddleTwoY = 0 ` PADDLE IS AT TOP OF SCREEN
SPRITE PaddleTwoSprite, PaddleTwoX, PaddleTwoY, PaddleTwoImage ` DRAW PADDLE TO SCREEN
ENDFUNCTION
Link to game:
http://mrhtml16.angelfire.com