Here's the code...:
CLS
HIDE MOUSE
SYNC ON
SYNC RATE 60
RANDOMIZE TIMER()
BOX 0,0,80,15
GET IMAGE 1,0,0,80,15
INK RGB(43,54,251),0
BOX 0,0,15,15
GET IMAGE 2,0,0,15,15
SPRITE 1,0,0,1
SPRITE 2,0,0,2
DO
CLS RGB(100,100,100)
playerx = 320 : playery = 450
ballx# = 320.0 : bally# = 400.0
ballyspeed# = 2.0
ballxspeed# = 2.0
speedinc# = 0.2
playerspeed = 0
playermove = 2
player = 1 : ball = 2
score = 0
REPEAT
IF RIGHTKEY()
playerspeed = playermove
ELSE
IF LEFTKEY()
playerspeed = 0 - playermove
ELSE
playerspeed = 0
ENDIF
ENDIF
IF SPRITE COLLISION(player,ball)
ballyspeed# = 0 - (ABS(ballyspeed#) + speedinc#)
random# = (RND(10)-5)/10.0
ballxspeed# = ballxspeed# + (playerspeed/2) + random#
score = score + 1
ENDIF
IF ballx# > 625.0 OR ballx# < 0.0 THEN ballxspeed# = 0.0 - ballxspeed#
IF bally# < 0.0 THEN ballyspeed# = 0.0 - ballyspeed#
playerx = playerx + playerspeed
ballx# = ballx# + ballxspeed#
bally# = bally# + ballyspeed#
SPRITE player,playerx,playery,player
SPRITE ball,ballx#,bally#,ball
SYNC
UNTIL bally# > 480
CLS
TEXT 100,0,"Score: "+STR$(score)
TEXT 100,50,"Press ENTER to play again, or SPACE to end"
REPEAT
SYNC
UNTIL RETURNKEY() OR SPACEKEY()
IF SPACEKEY() THEN EXIT
LOOP
END
Code of the Week: Moving an object back.
If Downkey()=1 then Move object x,-10
x=Object Number