Had some bugs in the code you posted SmartGuy, here's them fixed:
sync on : hide mouse
gosub init_stuff
gosub load_media
gosub main_menu
gosub load_level
`--------------------------------------------------
`MAIN LOOP
`--------------------------------------------------
do
gosub check_input
gosub update_stuff
if sprite collision(2,0)>0 then gosub check_collision
sync
loop
`-----------------------------------------------
`SUBROUTINES
`-----------------------------------------------
init_stuff:
rem this array hold data concerning bricks
rem (x,0) = brick type
rem (x,1) = x coordinate
rem (x,2) = y coordinate
rem (0,0) = number of bricks in level
dim brickdata(200,2)
return
load_media:
rem this bitmap will be updated with the border and currently active bricks
create bitmap 1,640,480
rem border
cls rgb(255,255,255)
ink 0,0
box 40,40,600,479
set current bitmap 0
rem bricks, for now just 1
cls rgb(255,255,255)
get image 101,0,0,79,7
cls 0
return
main_menu:
return
load_level:
rem example level
count=1
for x=220 to 420 step 66
for y=160 to 320 step 18
brickdata(count,0)=1
brickdata(count,1)=x
brickdata(count,2)=y
inc count
next y
next x
brickdata(0,0)=count-1
return
check_input:
inc paddlex, 3*(upkey() - downkey() )
if paddlex<40 then paddlex=40
if paddlex>600 then paddlex=600
return
update_stuff:
set current bitmap 1
count=0
repeat
inc count
paste image brickdata(count,0)+100,brickdata(count,1),brickdata(count,2)
until brickdata(0,0)
if image exist(1)=1 then delete image 1
get image 1,0,0,639,479
set current bitmap 0
sync
sprite 1,0,0,1
sprite 2,ballx-5,bally-5,2 : rem ball
sprite 3,paddlex-40,471,2
return
check_collision:
if sprite collision(2,1)
paste sprite 1,0,0
if point(ballx-6,bally)>0
rem left collision
ballmovex=1
endif
if point(ballx,bally-6)>0
rem top collision
ballmovey=0
endif
if point(ballx+6,bally)>0
rem right collision
ballmovex=0
endif
if point(ballx,bally+6)>0
rem bottom collision
ballmovey=1
endif
else
ballmovey=1
endif
cls
return
If I could, can I change my assignment from input to just fixing bugs.