Hi Apollonios. I just did a quick test to see if I could help out. I came up with this.
SuperStrict
Graphics 260, 500
Global LeftLArrWidth:Int = 3
Global leftLArrHeight:Int = 3
Global LeftLXOff:Int = 120
Global LeftLYOff:Int = 0
Global LXTemp:Int[4], LYTEmp:Int[4]
Global CreateLeftL:Int = 0
Global LeftLCreated:Int = 0
Global loopCount:Int = 0
Global LeftLTimer:Int = MilliSecs()
Global CHeckAheadTImer:Int = MilliSecs()
Global TimerSpeed:Int = 600
Global ReadDefData:Int = 0
Global RotL:Int = 0
Global RotCount:Int = 0
Global CanMoveLeft:Int = 1
Global CanMoveRight:Int = 1
Global LLCanRotate:Int = 1
Global ArrData:Int[20]
Global LeftL:Int[LeftLArrWidth, LeftLArrHeight]
Const GAMEARRAYWIDTH:Int = 13
Const GAMEARRAYHEIGHT:Int = 25
Global GameArray:Int[GAMEARRAYWIDTH, GAMEARRAYHEIGHT]
While not KeyHit(KEY_ESCAPE)
Cls
DrawLine 0, 60, 260, 60
CheckAhead()
For Local x:Int = 0 Until GAMEARRAYWIDTH
For Local Y:Int = 0 Until GAMEARRAYHEIGHT
If GameArray[x, y]= 1
DrawRect x * 20, y * 20, 20, 20
Else
End If
Next
Next
If LeftLCreated = 1
If MilliSecs() > LeftLTimer + TimerSpeed
LeftLYOff:+20
' If MilliSecs() > CHeckAheadTImer + 500
LeftLTimer = MilliSecs()
' EndIf
End If
If KeyHit(KEY_EQUALS)
TimerSpeed:-200
EndIf
If KeyHit(KEY_MINUS)
TimerSpeed:+200
End If
End If
If LeftLCreated = 1
For Local x:Int = 0 Until 3
For Local y:Int = 0 Until 3
If LeftL[x, y]= 1
DrawRect LeftLXOff + x * 20, LeftLYOff + Y * 20, 20, 20
Select loopCount
Case 0
LXTemp[0]= LeftLXOff + x * 20
LYTEmp[0]= LeftLYOff + Y * 20
Case 1
LXTemp[1]= LeftLXOff + x * 20
LYTEmp[1]= LeftLYOff + Y * 20
Case 2
LXTemp[2]= LeftLXOff + x * 20
LYTEmp[2]= LeftLYOff + Y * 20
Case 3
LXTemp[3]= LeftLXOff + x * 20
LYTEmp[3]= LeftLYOff + Y * 20
End Select
loopCount:+1
End If
If loopCount > 3 Then loopCount = 0
Next
Next
EndIf
If KeyHit(KEY_SPACE) and LeftLCreated = 0
RestoreData LeftL1
For Local y:Int = 0 Until 3
For Local x:Int = 0 Until 3
ReadData ArrData[0]
LeftL[x, y]= ArrData[0]
Next
Next
LeftLCreated = 1
End If
If LeftLCReated = 1
MoveRotate()
EndIf
Local tx1:Int, tx2:Int, tx3:Int, tx4:Int
Local ty1:Int, ty2:Int, ty3:Int, ty4:Int
DrawText "tx1= " + LXTemp[0], 0, 0
DrawText "ty1= " + LYTEmp[0], 80, 0
DrawText "tx2= " + LXTemp[1], 0, 15
DrawText "ty2= " + LYTEmp[1], 80, 15
DrawText "tx3= " + LXTemp[2], 0, 25
DrawText "ty3= " + LYTEmp[2], 80, 25
DrawText "tx4= " + LXTemp[3], 0, 35
DrawText "ty4= " + LYTEmp[3], 80, 35
DrawText "LoopCount= " + loopCount, 0, 45
DrawText "LeftlCReated= " + LeftLCreated, 0, 55
Flip
Wend
Function CheckAhead()
If LYTEmp[0]>= 500 - 20 or LYTEmp[1]>= 500 - 20 or LYTEmp[2]>= 500 - 20 or LYTEmp[3]>= 500 - 20
GameArray[LXTemp[0]/ 20, LYTEmp[0]/ 20]= 1
GameArray[LXTemp[1]/ 20, LYTEmp[1]/ 20]= 1
GameArray[LXTemp[2]/ 20, LYTEmp[2]/ 20]= 1
GameArray[LXTemp[3]/ 20, LYTEmp[3]/ 20]= 1
For Local iter:Int = 0 Until 4
LXTemp[iter]= 0
LYTEmp[iter]= 0
Next
LeftLXOff = 120
LeftLYOff = 0
' LeftLCreated = 0
End If
If GameArray[LXTemp[0]/ 20, LYTEmp[0]/ 20 + 1]= 1 or GameArray[LXTemp[1]/ 20, LYTEmp[1]/ 20 + 1]= 1 or ..
GameArray[LXTemp[2]/ 20, LYTEmp[2]/ 20 + 1]= 1 or GameArray[LXTemp[3]/ 20, LYTEmp[3]/ 20 + 1]= 1
GameArray[LXTemp[0]/ 20, LYTEmp[0]/ 20]= 1
GameArray[LXTemp[1]/ 20, LYTEmp[1]/ 20]= 1
GameArray[LXTemp[2]/ 20, LYTEmp[2]/ 20]= 1
GameArray[LXTemp[3]/ 20, LYTEmp[3]/ 20]= 1
For Local iter:Int = 0 Until 4
LXTemp[iter]= 0
LYTEmp[iter]= 0
Next
LeftLXOff = 120
LeftLYOff = 0
EndIf
End Function
Function MoveRotate()
If KeyHit(KEY_UP) and not KeyHit(KEY_DOWN) and LLCanRotate = 1
ReadDefData = 1
RotCount:+1
RotL = 1
If RotCount > 3 Then RotCount = 0
ElseIf KeyHit(KEY_DOWN) and not KeyHit(KEY_UP) LLCanRotate = 1
ReadDefData = 1
RotCount:-1
RotL = 1
If RotCount < 0 Then RotCount = 3
End If
If KeyHit(KEY_LEFT) and not KeyHit(KEY_RIGHT)
LeftLXOff:-20
If GameArray[LXTemp[0]/ 20 - 1, LYTEmp[0]/ 20]= 1 or GameArray[LXTemp[1]/ 20 - 1, LYTEmp[1]/ 20]= 1 or ..
GameArray[LXTemp[2]/ 20 - 1, LYTEmp[2]/ 20]= 1 or GameArray[LXTemp[3]/ 20 - 1, LYTEmp[3]/ 20]= 1
Else
EndIf
If LeftLXOff <= 0 Then LeftLXOff = 0
EndIf
If KeyHit(KEY_RIGHT) and not KeyHit(KEY_LEFT)
LeftLXOff:+20
If GameArray[LXTemp[0]/ 20 + 1, LYTEmp[0]/ 20]= 1 or GameArray[LXTemp[1]/ 20 + 1, LYTEmp[1]/ 20]= 1 or ..
GameArray[LXTemp[2]/ 20 + 1, LYTEmp[2]/ 20]= 1 or GameArray[LXTemp[3]/ 20 + 1, LYTEmp[3]/ 20]= 1
Else
EndIf
If LeftLXOff >= 500 Then LeftLXOff = 500
End If
If RotL = 1
Select RotCount
Case 0
If ReadDefData = 1
RestoreData LeftL1
ReadDefData = 0
End If
For Local y:Int = 0 Until 3
For Local x:Int = 0 Until 3
ReadData ArrData[0]
LeftL[x, y]= ArrData[0]
Next
Next
RotL = 0
ReadDefData = 0
Case 1
If ReadDefData = 1
RestoreData LeftL2
ReadDefData = 0
End If
For Local y:Int = 0 Until 3
For Local x:Int = 0 Until 3
ReadData ArrData[1]
LeftL[x, y]= ArrData[1]
Next
Next
RotL = 0
ReadDefData = 0
Case 2
If ReadDefData = 1
RestoreData LeftL3
ReadDefData = 0
End If
For Local y:Int = 0 Until 3
For Local x:Int = 0 Until 3
ReadData ArrData[2]
LeftL[x, y]= ArrData[2]
Next
Next
RotL = 0
ReadDefData = 0
Case 3
If ReadDefData = 1
RestoreData LeftL4
ReadDefData = 0
End If
For Local y:Int = 0 Until 3
For Local x:Int = 0 Until 3
ReadData ArrData[3]
LeftL[x, y]= ArrData[3]
Next
Next
RotL = 0
ReadDefData = 0
End Select
End If
End Function
'#Region
#LeftL1
DefData 0, 1, 0
DefData 0, 1, 0
DefData 1, 1, 0
#LeftL2
DefData 1, 0, 0
DefData 1, 1, 1
DefData 0, 0, 0
#LeftL3
DefData 0, 1, 1
DefData 0, 1, 0
DefData 0, 1, 0
#leftL4
DefData 0, 0, 0
DefData 1, 1, 1
DefData 0, 0, 1
'#End Region
Press the + or - key to increase or decrease fall speed. There's no bounds checking for left and right but there is collidable stackable collision checking.
Hope you find it usefull. :)
[edit] Press space bar to drop first shape. There's only one shape. You should get an idea of how it's done though. Don't know if this is the way Tetris is made but it's all I could think of at the time. :)