This is my second game.
it's a work in progress but I thought I'd share.
After all, sharing is caring
[edit] edited the code to delete any remaining sprites before showing the menu[/edit]
REMSTART
**********
*BREAKOUT*
**********
REMEND
rem hide the mouse set up sync etc etc etc
backdrop on:autocam off:hide mouse:sync on:sync rate 0
rem simple start screen
menu:
if score > highscore then highscore=score
for i=1 to 47
if sprite exist (i) then delete sprite i
next i
cls
sync
center text 320,240,"BREAKOUT"
center text 318,260,"PRESS A KEY"
center text 318,280,"High score today";
set cursor 400,280
print highscore
sync
suspend for key
rem clear score, reset lives
score=0
lives=3
null = make vector2(1)
start:
rem draw the bat
box 0,0,50,10
get image 1,0,0,50,10
sprite 1,0,0,1
offset sprite 1, sprite width(1)/2.0, sprite height(1)/2.0
rem position the bat
sprite 1,435,440,1
rem draw the ball
box 0,0,10,10
get image 2,0,0,10,10
cls
rem draw some blocks
p=13
d=20
for i=4 to 47
sprite i,30+p,20+d,1
offset sprite i, sprite width(i)/2.0, sprite height(i)/1.0
sync
p=p+55
wait 50
if i=14 or i=25 or i=36 then d=d+12:p=13
next i
newball:
rem position the ball
sprite 2,320,240,2
offset sprite 2, sprite width(2)/2.0, sprite height(2)/2.0
nx# = 2 : ny# = 3
set vector2 1,nx#, ny# : normalize vector2 1, 1
nx# = x vector2(1) : ny# = y vector2(1)
bx# = 0 : by# = 0
x=435
rem main loop
begin:
do
count=0
rem show score/lives
set cursor 10,10
print "Score: ";
print score ;
set cursor 550,10
print " lives: ";
print lives
rem sraw the screen
sync
rem check for keyboard input. check spritre is not at the edge of the screen if ok move bat
x = x + rightkey() - leftkey()
if x < 25 then x = 25
if x > screen width() - 25 then x = screen width() - 25
sprite 1,x,440,1
rem collision detection for the bat and ball
rem collision detection for the bat and ball
if sprite hit (2,1)
dx#=sprite x(2) - sprite x(1)
nx#=dx#/35
a#=acos(nx#)
ny#=-sin(a#)
endif
rem collision detection fot the edge of the screen
if sprite x(2) < 10 or sprite x(2) > 630 then ny# = ny#*1:nx# = nx#*-1
if sprite y(2) < 10 then ny# = ny#*-1:nx# = nx#*1
rem the following line starts the game again if the ball goes past the bat.
if sprite y(2) > 480 and lives=1 then lives=3:cls:goto menu
if sprite y(2) > 480 then lives=lives-1:cls:goto newball
rem move the ball
bx# = (bx# + nx#) : by# = (by# + ny#)
sprite 2, 320+bx#, 240+by#, 2
for i =4 to 47
if sprite hit (2,i)
nx# = nx#*1:ny# = ny#*-1
delete sprite i
score=score+100
endif
next i
for i=4 to 47
if sprite exist (i) then count=count+1
next i
if count=0 then lives=lives+1:score=score+1000:goto start
loop
There is one bug I need to iron out, the ball sometimes vanishes when it hits the edge of the bat.
Constructive criticism is very welcome.
[edit] I fixed the bug and added a few changes to the code. I'll keep updating it seeing as I've had such a fantastic response....

[/edit]