
I have 2 questions about it:
1) How do I remove the bottom line, when it's filled with boxes and move the whole image down, like in tetris?
3) How do i avoid program freezing? When I click the window, program freezes and the image dissapears. Same happens when closing the window.
Here comes the code:
Code: Select all
beginit:
StartDrawing(WindowOutput(0))
Box(0,0,400,400,#Black) ; General field
DrawingMode(#PB_2DDrawing_Outlined )
Dim lowfields.i(20) ; lowfields array, to make a box understand when it should stop falling
some1 = 380
ll = 1
For z = 1 To 200
wof = Random(19) ; vertical position to start
If lowfields(wof) = 20 : Goto stopit : EndIf ; If a box reaches the top of the field, we start again
some = some1 - lowfields(wof)*20 ; Fall until reaching some other box
For x = 0 To some Step 20 ; falling of a box
Delay(10)
Box(wof*20,x,20,20,RGB(Random(100)+100,Random(100)+100,Random(100)+100))
Box(wof*20,x-20,20,20,#Black) ;covering the previously drawn position to have moving effect.
Next
lowfields(wof) + 1; The next box knows when to stop now.
Next
stopit:
StopDrawing()
Goto beginit
