Simple stuff.
` Simple pong logic. For newbies.
` Use manual sync, and hide the mouse pointer
sync rate 0
sync on
hide mouse
` player start position
xp=10
yp=400
` Ball start position
bxp=30
byp=30
` Ball-direction-speed
bdx=3
bdy=3
` create some REALLY crude graphics
box 10,10,50,20
get image 1,10,10,50,20
get image 2,10,10,20,20
` Start the main program loop
do
` move the ball by the ball-direction-speed amounts
bxp=bxp+bdx
byp=byp+bdy
` bounce ball off the walls by reversing the balls direct
if bxp<=1 or bxp>=630 then bdx=0-bdx
if byp<=1 then bdy=0-bdy
` Game over if ball hits the floor
if byp>=470 then end
` move the player using the mouse for control
xp=xp+mousemovex()
if xp<1 then xp=1
if xp>600 then xp=600
` Display the player
sprite 1,xp,yp,1
` Display the ball
sprite 2,bxp,byp,2
` bounce ball off player
if sprite collision(1,2) = 1
`make sure ball does not go lower than player if it hits player.
`(this is to stop the ball getting 'stuck' in the player if hit side on).
byp=yp-10
`reverse balls direction
bdy=0-bdy
endif
` Sync the screen
sync
loop
Conrad Brown