Tetris
Posted: Tue Dec 28, 2010 9:48 pm
Code: Select all
nomainwin
graphicbox #T.G, 7, 7, 350, 420
menu #T, "Game", "New game", [Gameover], "Controls", [Controls], "Quit Game", [Quit]
UpperLeftX = 300
UpperLeftY = 100
WindowWidth = 370
WindowHeight = 540
open "Tetris" for graphics_nf_nsb as #T
print #T, "fill 250 100 100"
print #T.G, "when characterInput [Input]"
print #T, "trapclose [Quit]"
print #T.G, "setfocus"
loadbmp "Layout", "tetris\tetrisboard.bmp"
loadbmp "Nextpiece", "tetris\nextpiece.bmp"
loadbmp "1block", "tetris\redblock.bmp"
loadbmp "2block", "tetris\yellowblock.bmp"
loadbmp "3block", "tetris\greenblock.bmp"
loadbmp "4block", "tetris\blueblock.bmp"
loadbmp "5block", "tetris\tealblock.bmp"
loadbmp "6block", "tetris\purpleblock.bmp"
loadbmp "7block", "tetris\brownblock.bmp"
loadbmp "background", "tetris\background.bmp"
loadbmp "Next", "tetris\nexttext.bmp"
loadbmp "Hold", "tetris\holdtext.bmp"
print #T.G, "background background"
print #T.G, "addsprite Layout Layout"
print #T.G, "spritexy Layout 10 10"
print #T.G, "addsprite Nextpiece Nextpiece"
print #T.G, "spritexy Nextpiece 250 10"
print #T.G, "addsprite Hold Nextpiece"
print #T.G, "spritexy Hold 250 100"
print #T.G, "addsprite NextT Next"
print #T.G, "spritexy NextT 245 51"
print #T.G, "addsprite HoldT Hold"
print #T.G, "spritexy HoldT 245 141"
[Play]
playwave "tetris.wav", loop
global BlockNumber, Nextblock, Getblock, BlockX, BlockY, Start, Playblock, Blockturn, Playstart, Checky, RemoveBlock1, RemoveBlock2, Blockstop
global Time1, Time2, Blockright, Blockleft, Rotate, Block, Blockway, ActiveNumber, Fallrate, Rate, Deletex, Gameover, Stepdown, Ctrl, Shift, Blocktop
global BlockHold, BlockSwitch, PlayRestore, Score, Hold, BlockRestore, HoldBlock, BlockStay, Points, Level, Lines, LevelUp, Clock1, Clock2, tick
BlockNumber = 1
Fallrate = 1000
Rate = 1000
Deletex = 12
Checky = 391
Gameover = 0
Getblock = 0
Start = 0
dim Setblock$(192, 391)
dim Lin(391)
Ctrl$ = chr$(_VK_CONTROL)
Ctrl = 0
Shift$ = chr$(_VK_SHIFT)
Shift = 0
Hold = 0
BlockSwitch = 0
BlockStay = 0
Score = 0
Points = 0
Level = 1
Lines = 12
LevelUp = 0
Blockstop = 0
open "C:\Program Files\Tetris\tetris\highscore\highscoretetris.txt" for binary as #highscore
input #highscore, HighScore
print #T, "backcolor 250 100 100"
print #T, "color 50 0 50"
print #T, "place 1 440" : print #T, "\Level: "; Level
print #T, "place 1 455" : print #T, "\Lines Left: "; Lines
print #T, "place 1 475" : print #T, "\Score: "; Score
print #T, "place 1 490" : print #T, "\High Score: "; HighScore
print #T, "flush"
[Main]
if Getblock = 0 then call GetBlock
if Gameover = 1 then goto [Gameover]
call Gametimer
call BlockMove
call Collides
print #T.G, "drawsprites"
if Points > 0 then call Score
if LevelUp > 0 then call Level
scan
goto [Main]
[Input]
Key$ = left$(Inkey$, 2)
if (right$(Key$, 1) = "'" or Inkey$ = "l" or Inkey$ = "6") and BlockX < Blockright then BlockX = BlockX + 20 : Blockway = 1
if (right$(Key$, 1) = "%" or Inkey$ = "j" or Inkey$ = "4") and BlockX > Blockleft then BlockX = BlockX - 20 : Blockway = 2
if (right$(Key$, 1) = "&" or Inkey$ = "i" or Inkey$ = "5") then Rotate = 1 : Blockway = 3
if (right$(Key$, 1) = "(" or Inkey$ = "k" or Inkey$ = "2") then Stepdown = 1
if Inkey$ = "8" then Fallrate = 0
if Inkey$ = "0" then goto [Quit]
if right$(Key$, 1) = Ctrl$ then
if Ctrl = 0 then
Fallrate = 0 : Ctrl = 1
else
Ctrl = 0
end if
end if
if right$(Key$, 1) = Shift$ then
if Shift = 0 then
Shift = 1
Blockway = 3
ActiveNumber = BlockNumber - 8
[Block11]
data -40, 0, -20, 0, 0, 0, 20, 0
[Block21]
data -20, 0, 0, 0, -20, 20, 0, 20
[Block31]
data -20, 0, 0, 0, 20, 0, 0, 20
[Block41]
data -20, 0, 0, 0, 20, 0, -20, 20
[Block51]
data -20, 0, 0, 0, 20, 0, 20, 20
[Block61]
data -20, 20, 0, 20, 0, 0, 20, 0
[Block71]
data -20, 0, 0, 0, 0, 20, 20, 20
select case Playblock
case 1
restore [Block11]
case 2
restore [Block21]
case 3
restore [Block31]
case 4
restore [Block41]
case 5
restore [Block51]
case 6
restore [Block61]
case 7
restore [Block71]
end select
while BlockCounter < 4
read X, Y
print #T.G, "spritexy "; Playblock; "block"; ActiveNumber; " "; 293 + X; " "; 101 + Y
BlockCounter = BlockCounter + 1
ActiveNumber = ActiveNumber + 1
wend
BlockCounter = 0
if Hold = 1 then
BlockRestore = BlockNumber
BlockNumber = BlockHold
PlayRestore = Playblock
Playblock = HoldBlock
if BlockSwitch = 0 then
BlockSwitch = 1
else
BlockSwitch = 0
end if
ActiveNumber = BlockNumber - 8
select case HoldBlock
case 1
restore [Block11]
case 2
restore [Block21]
case 3
restore [Block31]
case 4
restore [Block41]
case 5
restore [Block51]
case 6
restore [Block61]
case 7
restore [Block71]
end select
while BlockCounter < 4
read X, Y
print #T.G, "spritexy "; Playblock; "block"; ActiveNumber; " "; BlockX + X; " "; BlockY + Y
BlockCounter = BlockCounter + 1
ActiveNumber = ActiveNumber + 1
wend
BlockCounter = 0
if Playblock = 1 then Blockturn = 1
if Playblock = 2 then Blockturn = 3
if Playblock = 3 then Blockturn = 4
if Playblock = 4 then Blockturn = 8
if Playblock = 5 then Blockturn = 12
if Playblock = 6 then Blockturn = 16
if Playblock = 7 then Blockturn = 18
end if
if Hold = 0 then
BlockHold = BlockNumber
HoldBlock = Playblock
BlockStay = 1
Getblock = 0
Hold = 1
else
BlockHold = BlockRestore
HoldBlock = PlayRestore
end if
else
Shift = 0
end if
end if
goto [Main]
[Quit]
confirm "Done playing?"; Quit$
if Quit$ = "yes" then
playwave ""
close #highscore
close #T : end
else
goto [Main]
end if
[Controls]
Control$ = "Contols" + chr$(13) + "Left = left arrow, j, 4" + chr$(13) + "Right = right arrow, l, 6" + chr$(13) + "Down = down arrow, k, 2" + chr$(13)
Control$ = Control$ + "Rotate = up arrow, i, 5" + chr$(13) + "Drop = CTRL, 8" + chr$(13) + "Hold = SHIFT"
notice Control$
goto [Main]
[Close]
close #C
print #T.G, "setfocus"
goto [Main]
[Gameover]
if Score > HighScore then
seek #highscore, 0
print #highscore, Score
seek #highscore, 0
input #highscore, HighScore
HighScore$ = ""; HighScore
Confirm$ = "Game Over" + chr$(13) + chr$(13)
Confirm$ = Confirm$ + "New High Score!!!" + chr$(13) + HighScore$ + chr$(13) + chr$(13)
Confirm$ = Confirm$ + "Play Again?"
else
Confirm$ = "Game Over" + chr$(13) + chr$(13) + "Play Again?"
end if
confirm Confirm$; Playagain$
if Playagain$ = "yes" then
Checky = 391
Deletex = 12
while Checky >= 11
while Deletex <= 192
if Setblock$(Deletex, Checky) > " " then
print #T.G, "removesprite "; Setblock$(Deletex, Checky)
Setblock$(Deletex, Checky) = " "
end if
if Deletex = 192 then Lin(Checky) = 0
Deletex = Deletex + 20
wend
Deletex = 12
Checky = Checky - 20
wend
Checky = 391
BlockCounter = 1
while BlockCounter <= 4
print #T.G, "removesprite "; RemoveBlock1; "block"; BlockNumber - BlockCounter
print #T.G, "removesprite "; RemoveBlock2; "block"; (BlockNumber - BlockCounter) - 4
BlockCounter = BlockCounter + 1
wend
BlockCounter = 1
if Hold = 1 then
while BlockCounter <= 4
print #T.G, "removesprite "; HoldBlock; "block"; (BlockHold - BlockCounter) - 4
BlockCounter = BlockCounter + 1
wend
end if
print #T, "place 1 440" : print #T, "\ "
print #T, "place 1 455" : print #T, "\ "
print #T, "place 1 475" : print #T, "\ "
print #T, "place 1 490" : print #T, "\ "
BlockCounter = 0
close #highscore
goto [Play]
else
goto [Quit]
end if
sub Gametimer
if Playstart = 1 then
Time1 = time$("milliseconds")
Clock1 = time$("milliseconds")
Playstart = 0
end if
Time2 = time$("milliseconds")
if Time2 - Time1 >= Fallrate or Stepdown = 1 then
if Fallrate = 0 or Stepdown = 1 then Points = Points + 5
BlockY = BlockY + 20
Blockstop = 1
Time1 = time$("milliseconds")
Stepdown = 0
end if
Clock2 = time$("milliseconds")
while Clock2 - Clock1 < 15
Clock2 = time$("milliseconds")
wend
Clock1 = time$("milliseconds")
end sub
sub Score
Score = Score + Points
print #T, "place 1 475" : print #T, "\ "
print #T, "place 1 475" : print #T, "\Score: "; Score
Points = 0
end sub
sub Level
Lines = Lines - LevelUp
if Lines <= 0 then
Level = Level + 1
Rate = Rate / 1.2
Lines = 12
print #T, "place 1 440" : print #T, "\ "
print #T, "place 1 440" : print #T, "\Level: "; Level
end if
print #T, "place 1 455" : print #T, "\ "
print #T, "place 1 455" : print #T, "\Lines left: "; Lines
LevelUp = 0
end sub
sub Collides
[Block11]
data -40, 0, -20, 0, 0, 0, 20, 0, 1, 0
[Block12]
data 0, -20, 0, 0, 0, 20, 0, 40, 1, 2
[Block21]
data -20, 0, 0, 0, -20, 20, 0, 20, 1, 1
[Block31]
data -20, 0, 0, 0, 20, 0, 0, 20, 1, 0
[Block32]
data 0, -20, 0, 0, 0, 20, 20, 0, 1, 0
[Block33]
data -20, 0, 0, 0, 20, 0, 0, -20, 1, 0
[Block34]
data 0, -20, 0, 0, 0, 20, -20, 0, 1, 4
[Block41]
data -20, 0, 0, 0, 20, 0, -20, 20, 1, 0
[Block42]
data 0, -20, 0, 0, 0, 20, 20, 20, 1, 0
[Block43]
data -20, 0, 0, 0, 20, 0, 20, -20, 1, 0
[Block44]
data 0, -20, 0, 0, 0, 20, -20, -20, 1, 4
[Block51]
data -20, 0, 0, 0, 20, 0, 20, 20, 1, 0
[Block52]
data 0, -20, 0, 0, 0, 20, 20, -20, 1, 0
[Block53]
data -20, 0, 0, 0, 20, 0, -20, -20, 1, 0
[Block54]
data 0, -20, 0, 0, 0, 20, -20, 20, 1, 4
[Block61]
data -20, 20, 0, 20, 0, 0, 20, 0, 1, 0
[Block62]
data 0, -20, 0, 0, 20, 0, 20, 20, 1, 2
[Block71]
data -20, 0, 0, 0, 0, 20, 20, 20, 1, 0
[Block72]
data 0, 20, 0, 0, 20, 0, 20, -20, 1, 2
ActiveNumber = BlockNumber - 8
while BlockCounter < 4
print #T.G, "spritecollides "; Playblock; "block"; ActiveNumber; " Collide$"
print #T.G, "spritexy? "; Playblock; "block"; ActiveNumber; " GetX GetY"
if Collide$ > "Layout " or GetY > 391 then
if Collide$ > "Layout" and Blockstop = 0 then exit while
ActiveNumber = BlockNumber - 8
BlockCounter = 0
if GetY > 391 and Blockway <> 3 then Blockstop = 1
select case Blockway
case 1
BlockX = BlockX - 20
case 2
BlockX = BlockX + 20
case 3
BlockY = BlockY - 20
end select
if Blockstop = 1 and Blockway = 0 then
BlockY = BlockY - 20
call CheckBlock
exit while
Blockstop = 0
end if
Blockway = 0
select case Blockturn
case 1
restore [Block11]
case 2
restore [Block12]
case 3
restore [Block21]
case 4
restore [Block31]
case 5
restore [Block32]
case 6
restore [Block33]
case 7
restore [Block34]
case 8
restore [Block41]
case 9
restore [Block42]
case 10
restore [Block43]
case 11
restore [Block44]
case 12
restore [Block51]
case 13
restore [Block52]
case 14
restore [Block53]
case 15
restore [Block54]
case 16
restore [Block61]
case 17
restore [Block62]
case 18
restore [Block71]
case 19
restore [Block72]
end select
while BlockCounter < 4
read X, Y
print #T.G, "spritexy "; Playblock; "block"; ActiveNumber; " "; BlockX + X; " "; BlockY + Y
BlockCounter = BlockCounter + 1
ActiveNumber = ActiveNumber + 1
wend
BlockCounter = -1
ActiveNumber = BlockNumber - 9
end if
BlockCounter = BlockCounter + 1
ActiveNumber = ActiveNumber + 1
wend
Blockway = 0
BlockCounter = 0
end sub
sub BlockMove
[Block11]
data -40, 0, -20, 0, 0, 0, 20, 0, 1, 0
[Block12]
data 0, -20, 0, 0, 0, 20, 0, 40, 1, 2
[Block21]
data -20, 0, 0, 0, -20, 20, 0, 20, 1, 1
[Block31]
data -20, 0, 0, 0, 20, 0, 0, 20, 1, 0
[Block32]
data 0, -20, 0, 0, 0, 20, 20, 0, 1, 0
[Block33]
data -20, 0, 0, 0, 20, 0, 0, -20, 1, 0
[Block34]
data 0, -20, 0, 0, 0, 20, -20, 0, 1, 4
[Block41]
data -20, 0, 0, 0, 20, 0, -20, 20, 1, 0
[Block42]
data 0, -20, 0, 0, 0, 20, 20, 20, 1, 0
[Block43]
data -20, 0, 0, 0, 20, 0, 20, -20, 1, 0
[Block44]
data 0, -20, 0, 0, 0, 20, -20, -20, 1, 4
[Block51]
data -20, 0, 0, 0, 20, 0, 20, 20, 1, 0
[Block52]
data 0, -20, 0, 0, 0, 20, 20, -20, 1, 0
[Block53]
data -20, 0, 0, 0, 20, 0, -20, -20, 1, 0
[Block54]
data 0, -20, 0, 0, 0, 20, -20, 20, 1, 4
[Block61]
data -20, 20, 0, 20, 0, 0, 20, 0, 1, 0
[Block62]
data 0, -20, 0, 0, 20, 0, 20, 20, 1, 2
[Block71]
data -20, 0, 0, 0, 0, 20, 20, 20, 1, 0
[Block72]
data 0, 20, 0, 0, 20, 0, 20, -20, 1, 2
ActiveNumber = BlockNumber - 8
while BlockCounter < 4
read X, Y
if X = 1 or Playstart = 1 then
if Rotate = 1 then
Blockturn = Blockturn + 1
Blockturn = Blockturn - Y
Rotate = 0
end if
select case Blockturn
case 1
restore [Block11]
Blockright = 172
Blockleft = 52
Blocktop = 11
case 2
restore [Block12]
Blockright = 192
Blockleft = 12
Blocktop = 31
case 3
restore [Block21]
Blockright = 192
Blockleft = 32
Blocktop = 11
case 4
restore [Block31]
Blockright = 172
Blockleft = 32
Blocktop = 11
case 5
restore [Block32]
Blockright = 172
Blockleft = 12
Blocktop = 31
case 6
restore [Block33]
Blockright = 172
Blockleft = 32
Blocktop = 31
case 7
restore [Block34]
Blockright = 192
Blockleft = 32
Blocktop = 31
case 8
restore [Block41]
Blockright = 172
Blockleft = 32
Blocktop = 11
case 9
restore [Block42]
Blockright = 172
Blockleft = 12
Blocktop = 31
case 10
restore [Block43]
Blockright = 172
Blockleft = 32
Blocktop = 31
case 11
restore [Block44]
Blockright = 192
Blockleft = 32
Blocktop = 31
case 12
restore [Block51]
Blockright = 172
Blockleft = 32
Blocktop = 11
case 13
restore [Block52]
Blockright = 172
Blockleft = 12
Blocktop = 31
case 14
restore [Block53]
Blockright = 172
Blockleft = 32
Blocktop = 31
case 15
restore [Block54]
Blockright = 192
Blockleft = 32
Blocktop = 31
case 16
restore [Block61]
Blockright = 172
Blockleft = 32
Blocktop = 11
case 17
restore [Block62]
Blockright = 172
Blockleft = 12
Blocktop = 31
case 18
restore [Block71]
Blockright = 172
Blockleft = 32
Blocktop = 11
case 19
restore [Block72]
Blockright = 172
Blockleft = 12
Blocktop = 31
end select
if BlockX > Blockright then BlockX = Blockright
if BlockX < Blockleft then BlockX = Blockleft
if BlockY < Blocktop then BlockY = Blocktop
read X, Y
end if
print #T.G, "spritexy "; Playblock; "block"; ActiveNumber; " "; BlockX + X; " "; BlockY + Y
ActiveNumber = ActiveNumber + 1
BlockCounter = BlockCounter + 1
wend
BlockCounter = 0
end sub
sub CheckBlock
[Block11]
data -40, 0, -20, 0, 0, 0, 20, 0, 1, 0
[Block12]
data 0, -20, 0, 0, 0, 20, 0, 40, 1, 2
[Block21]
data -20, 0, 0, 0, -20, 20, 0, 20, 1, 1
[Block31]
data -20, 0, 0, 0, 20, 0, 0, 20, 1, 0
[Block32]
data 0, -20, 0, 0, 0, 20, 20, 0, 1, 0
[Block33]
data -20, 0, 0, 0, 20, 0, 0, -20, 1, 0
[Block34]
data 0, -20, 0, 0, 0, 20, -20, 0, 1, 4
[Block41]
data -20, 0, 0, 0, 20, 0, -20, 20, 1, 0
[Block42]
data 0, -20, 0, 0, 0, 20, 20, 20, 1, 0
[Block43]
data -20, 0, 0, 0, 20, 0, 20, -20, 1, 0
[Block44]
data 0, -20, 0, 0, 0, 20, -20, -20, 1, 4
[Block51]
data -20, 0, 0, 0, 20, 0, 20, 20, 1, 0
[Block52]
data 0, -20, 0, 0, 0, 20, 20, -20, 1, 0
[Block53]
data -20, 0, 0, 0, 20, 0, -20, -20, 1, 0
[Block54]
data 0, -20, 0, 0, 0, 20, -20, 20, 1, 4
[Block61]
data -20, 20, 0, 20, 0, 0, 20, 0, 1, 0
[Block62]
data 0, -20, 0, 0, 20, 0, 20, 20, 1, 2
[Block71]
data -20, 0, 0, 0, 0, 20, 20, 20, 1, 0
[Block72]
data 0, 20, 0, 0, 20, 0, 20, -20, 1, 2
select case Blockturn
case 1
restore [Block11]
case 2
restore [Block12]
case 3
restore [Block21]
case 4
restore [Block31]
case 5
restore [Block32]
case 6
restore [Block33]
case 7
restore [Block34]
case 8
restore [Block41]
case 9
restore [Block42]
case 10
restore [Block43]
case 11
restore [Block44]
case 12
restore [Block51]
case 13
restore [Block52]
case 14
restore [Block53]
case 15
restore [Block54]
case 16
restore [Block61]
case 17
restore [Block62]
case 18
restore [Block71]
case 19
restore [Block72]
end select
while BlockCounter < 4
read X, Y
print #T.G, "spritexy "; Playblock; "block"; ActiveNumber; " "; BlockX + X; " "; BlockY + Y
print #T.G, "spritexy? "; Playblock; "block"; ActiveNumber; " GetX GetY"
if GetY < 0 then
print #T.G, "removesprite "; Playblock; "block"; ActiveNumber
if BlockCounter = 3 then goto [Gameover]
else
Setblock$(GetX, GetY) = Playblock; "block"; ActiveNumber
Lin(GetY) = Lin(GetY) + 1
end if
BlockCounter = BlockCounter + 1
ActiveNumber = ActiveNumber + 1
wend
while Checky >= 11
if Lin(Checky) = 10 then
Points = (Points + 100) * 2
LevelUp = LevelUp + 1
while Deletex <= 192
print #T.G, "removesprite "; Setblock$(Deletex, Checky)
Setblock$(Deletex, Checky) = " "
if Deletex = 192 then Lin(Checky) = 0
Deletex = Deletex + 20
wend
Deletex = 12
GetY = Checky
while GetY > 11
GetY = GetY - 20
while Deletex <= 192 and Lin(GetY) > 0
if Setblock$(Deletex, GetY) > " " then
print #T.G, "spritexy? "; Setblock$(Deletex, GetY); " Fallx Fally"
print #T.G, "spritexy "; Setblock$(Deletex, GetY); " "; Fallx; " "; Fally + 20
Setblock$(Deletex, GetY + 20) = Setblock$(Deletex, GetY)
Setblock$(Deletex, GetY) = " "
end if
if Deletex = 192 then
Lin(GetY + 20) = Lin(GetY)
Lin(GetY) = 0
end if
Deletex = Deletex + 20
wend
Deletex = 12
wend
Checky = 411
end if
Checky = Checky - 20
wend
Checky = 391
Getblock = 0
Fallrate = Rate
BlockCounter = 0
ActiveNumber = BlockNumber - 8
end sub
sub GetBlock
if BlockSwitch = 1 then
BlockNumber = BlockRestore
BlockSwitch = 0
end if
[Block11]
data -40, 0, -20, 0, 0, 0, 20, 0
[Block21]
data -20, 0, 0, 0, -20, 20, 0, 20
[Block31]
data -20, 0, 0, 0, 20, 0, 0, 20
[Block41]
data -20, 0, 0, 0, 20, 0, -20, 20
[Block51]
data -20, 0, 0, 0, 20, 0, 20, 20
[Block61]
data -20, 20, 0, 20, 0, 0, 20, 0
[Block71]
data -20, 0, 0, 0, 0, 20, 20, 20
if Start = 0 then goto [Start]
[Loop]
if BlockStay = 0 then
BlockX = 112
BlockY = 11
else
BlockStay = 0
end if
Playblock = Block
select case Block
case 1
restore [Block11]
case 2
restore [Block21]
case 3
restore [Block31]
case 4
restore [Block41]
case 5
restore [Block51]
case 6
restore [Block61]
case 7
restore [Block71]
end select
RemoveBlock2 = Block
while BlockCounter < 4
read X, Y
print #T.G, "spritexy "; Block; "block"; (BlockNumber - BlockCounter) - 1; " "; BlockX + X; " "; BlockY + Y
print #T.G, "spritecollides "; Block; "block"; (BlockNumber - BlockCounter) - 1; " Collide$"
if Collide$ > "Layout " then Gameover = 1
BlockCounter = BlockCounter + 1
wend
BlockCounter = 0
[Start]
RepeatBlock = Block
while RepeatBlock = Block
Block = int(rnd(1) * 7) + 1
wend
select case Block
case 1
restore [Block11]
case 2
restore [Block21]
case 3
restore [Block31]
case 4
restore [Block41]
case 5
restore [Block51]
case 6
restore [Block61]
case 7
restore [Block71]
end select
RemoveBlock1 = Block
while BlockCounter < 4
print #T.G, "addsprite "; Block; "block"; BlockNumber; " "; Block; "block"
read X, Y
print #T.G, "spritexy "; Block; "block"; BlockNumber; " "; 293 + X; " "; 11 + Y
BlockCounter = BlockCounter + 1
BlockNumber = BlockNumber + 1
wend
BlockCounter = 0
if Start = 0 then
Start = 1
goto [Loop]
end if
Getblock = 1
if Playblock = 1 then Blockturn = 1
if Playblock = 2 then Blockturn = 3
if Playblock = 3 then Blockturn = 4
if Playblock = 4 then Blockturn = 8
if Playblock = 5 then Blockturn = 12
if Playblock = 6 then Blockturn = 16
if Playblock = 7 then Blockturn = 18
Playstart = 1
end sub