k fine. here is my code:
sync on
`loads images
gosub imageload
`creates menu
gosub menu
aftermenu:
`resets all variables
gosub initvars
`sets up screen
gosub display
`main loop
do
`checks for mouseclick on bricks
gosub lift
`checks position and collision of sprite
gosub spritepos
`allows mouse to drop brick on mouse click
gosub drop
`positions brick on template grid
gosub snap2grid
`checks for completion
gosub conditioncheck
sync
loop
end
imageload:
`loads menu background
load image "menu.bmp",1
`loads new button
load image "new.bmp",2
`loads instructions button
load image "instructions.bmp",3
`loads instructions image
load image "howtoplay.bmp",4
`loads quit button
load image "quit.bmp",5
`loads game background
load image "template.bmp",6
`loads game board
load image "grid.bmp",7
`loads + brick
load bitmap "Pieces\+template.bmp",1
`loads ^ brick
load bitmap "Pieces\^ template.bmp",2
`loads a brick
load bitmap "Pieces\a template.bmp",3
`loads c brick
load bitmap "Pieces\C template.bmp",4
`loads F brick
load bitmap "Pieces\F template.bmp",5
`loads h brick
load bitmap "Pieces\h template.bmp",6
`loads I brick
load bitmap "Pieces\I template.bmp",7
`loads L brick
load bitmap "Pieces\L template.bmp",8
`loads r brick
load bitmap "Pieces\r template.bmp",9
`loads W brick
load bitmap "Pieces\W template.bmp",10
`loads Z brick
load bitmap "Pieces\Z template.bmp",11
`loads T brick
load bitmap "Pieces\t template.bmp",12
`gets red and white sides
`+ red
set current bitmap 1
get image 8,0,0,59,59
`+white
get image 20,0,60,59,119
`^ red
set current bitmap 2
get image 9,0,0,59,59
`^ white
get image 21,0,60,59,119
`a red
set current bitmap 3
get image 10,0,0,39,59
`a white
get image 22,0,60,39,119
`C red
set current bitmap 4
get image 11,0,0,58,39
`C white
get image 23,0,40,58,80
`F red
set current bitmap 5
get image 12,0,0,59,59
`F white
get image 24,0,60,59,119
`loads mouse collision pic
load image "mouse.bmp",20
return
menu:
`loads background image to screen
load bitmap "menu.bmp",0
` sprite 1,0,0,1
`loads new button
sprite 2,257,300,2
`257,300
`361,332
`loads instructions button
sprite 3,258,340,3
`loads quit button
sprite 4,260,380,5
`loads mouse collision image
` sprite 1,mousex(),mousey(),20
`sets sprites to show black
for i=2 to 4
set sprite i,1,0
next i
` set sprite 1,1,0
do
`positions mouse collision box over mouse
` sprite 1,mousex(),mousey(),20
`checks for click on new button
if mouseclick()=1 and mousex()>=257 and mousex()<=361 and mousey()>=300 and mousey()<=332
`clears sprites from screen
gosub freesprite
`leaves subroutine
goto aftermenu
endif
`checks for click on instructions button
if mouseclick()=1 and mousex()>=258 and mousex()<=364 and mousey()>=340 and mousey()<=372
`displays instructions
sprite 5,320,240,4
set sprite 5,1,0
`wait for player to release mouse button
repeat
until mouseclick()=0
`wait for player to press key or click mouse
repeat
sync
until mouseclick()=1 or scancode()>0
delete sprite 5
endif
`checks for click on quit button
if mouseclick()=1 and mousex()>=260 and mousex()<=307 and mousey()>=380 and mousey()<=404
`goes to the quit subroutine
goto quit
endif
` col=sprite hit(1,0)
` text 0,0,str$(col)
sync
loop
return
initvars:
time=0
score=0
pieces=12
return
freesprite:
for i=1 to 25
if sprite exist(i)=1 then delete sprite i
next i
return
display:
`creates background
sprite 1,0,0,6
`set sprite 1,1,0
`creates grid
load bitmap "grid.bmp",0
`bricks
`+ brick
sprite 2,0,0,8
`^ brick
sprite 3,0,0,9
`loads a brick
sprite 4,0,0,10
`loads c brick
sprite 5,0,0,11
`loads F brick
sprite 6,0,0,12
`loads h brick
sprite 7,0,0,13
`loads I brick
sprite 8,0,0,14
`loads L brick
sprite 9,0,0,15
`loads r brick
sprite 10,0,0,16
`loads W brick
sprite 11,0,0,17
`loads Z brick
sprite 12,0,0,18
`loads T brick
sprite 13,0,0,19
return
lift:
return
spritepos:
return
drop:
return
snap2grid:
return
conditioncheck:
return
quit:
cls
end
return