I did not see in your program where you put in for the blocks to fall down. I made some edits to your code to at least put in where the blocks would fall. You cannot turn the blocks or move them left/right, and also there is no check to see if the block has fallen upon another block, so there still is a fair amount of work to do.
I noticed your program had a dreaded goto statement and I took it out in the edit. Gotos will tend toward 'spaghetti code' and you really don't want that when you are trying to figure out a bug. Right now, there is no way to lose the game, so the program never returns from the main loop.
I also put in a select / endselect with case / endcase in your menu code. Check this out, it makes for neater code. You could use the same method for the menu text also.
sync on
hide mouse
randomize timer()
wait 100
load music "media/tetris.mid",1 : loop music 1
x = screen width()/2
y = screen height()/2
load image "media/block1.bmp",1
load image "media/block2.bmp",2
load image "media/block3.bmp",3
load image "media/block4.bmp",4
load image "media/block5.bmp",5
score = 0
score$ = str$(score)
time = 240
time$ = str$(time)
level = 1
level$ = str$(level)
lines = 10
lines$ = str$(lines)
main_menu:
load image "media/title.bmp",1000
set text size 36
set text font "MEGZ"
blue=RGB(0,128,255)
white=RGB(255,255,255)
selectedItem=1
hold=1
do
cls
paste image 1000,0,300
if selectedItem=1 then ink blue,0 else ink white,0
text 0,0,"Play Game"
if selectedItem=2 then ink blue,0 else ink white,0
text 50,75,"Instructions"
if selectedItem=3 then ink blue,0 else ink white,0
text 100,150,"About"
if selectedItem=4 then ink blue,0 else ink white,0
text 150,225,"Exit"
if joystick up()=1 and hold=0 then dec selectedItem : hold=1
if joystick down()=1 and hold=0 then inc selectedItem : hold=1
if joystick y()=0 then hold=0
if selectedItem>4 then selectedItem=1
if selectedItem<1 then selectedITem=4
if joystick fire c()=1 and hold=0
select selectedItem
hold=1
case 1
gosub main
end
endcase
case 2
hold = 1
load image "media/instructions.bmp",1001
paste image 1001,64,32
sync : sync
wait 100
if joystick fire a()=1 and hold=1
delete image 1001
endif
endcase
case 3
hold = 1
load image "media/about.bmp",1001
paste image 1001,64,32
sync : sync
wait 100
if joystick fire a()=1 and hold=1
delete image 1001
endif
endcase
case 4
end
endcase
endselect
endif
sync
loop
return
main:
CLS
set text font "MEGZ"
set text size 36
center text x-80,y,"L" : sleep 1000 : center text x-40,y,"O" : sleep 250 : center text x,y,"A" : sleep 800 : center text x+40,y,"D" : sleep 500 : center text x+80,y,"E" : sleep 500 : center text x+120,y,"D" : sleep 600
CLS
load bitmap "media\gamescreen.bmp",1
copy bitmap 1,0
set current bitmap 0
center text 100,70,level$
next_block=rnd(4)+1
gosub dp_next_block
gosub set_block
do
gosub drop_block
center text 100,320,score$
center text x-2,410,lines$
center text 540,318,time$ : time=time-1
sync
loop
return
dp_next_block:
current_block=next_block
next_block=rnd(4)+1
ink rgb(128,128,128),0 : ` gray
box 481,67,608,178
restore block_width_height
for b=1 to next_block
read bwid,bhgt
next b
x=544-(bwid/2)
y=122-(bhgt/2)
sprite 2,x,y,next_block
paste sprite 2,x,y
sync
delete sprite 2
return
block_width_height:
` block width, block height 1 - 5
data 30,45,45,30,15,75,30,30,45,30
drop_block:
if timer()<block_timer then return
` need to put in a check to see if it fell onto other blocks
inc blocky,5
sprite 1,blockx,blocky,current_block
if blocky+bhgt>=383
paste sprite 1,blockx,blocky
sync
delete sprite 1
gosub dp_next_block
gosub set_block
endif
block_timer=timer()+100
return
set_block:
restore block_width_height
for b=1 to current_block
read bwid,bhgt
next b
blockx=311
if bwid=45 then blockx=296
if bwid=15 then blockx=326
blocky=8
sprite 1,blockx,blocky,current_block
block_timer=timer()+100
return
Also, when the 'next block' is placed on the screen, I used a box colored with gray 'ink rgb(128,128,128),0' as a background for the next block. I would use your paint program to fill in the next block area with this color on your 'gamescreen' bitmap so you don't have gaps at the top and bottom (the corners were rounded so I couldn't make the box to fill it).
Hope this is of some help to you.
LB