My error is at this line of code: for y = 1 to 24
The error states: Command out of place at line 111. Compilation failed (Syntax Errors)
`------ Client Settings --------
set display mode 800, 600, 16
set window title "Tetris Remake!"
sync on
sync rate 40
hide mouse
`------ Define Shapes --------
` Each of these load into a 4x4 block that instructs
` the Board() array where to initially position the objects
Data 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 `O
Data 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0 `I
Data 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 `L
Data 0, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 `J
Data 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 `S
Data 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 `Z
Data 0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 `T
`shapes rotated 90 degrees cw - may not be necessary
Data 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 `O
Data 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0 `I
Data 0, 1, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0 `L
Data 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0 `J
Data 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0 `S
Data 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0 `Z
Data 0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0 `T
`rotated 180 degrees cw - may not be necessary
Data 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 `O
Data 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0 `I
Data 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0 `L
Data 0, 0, 0, 0, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0 `J
Data 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 `S
Data 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 `Z
Data 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0 `T
`rotated 270 degrees cw - may not be necessary
Data 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 `O
Data 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0 `I
Data 0, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0 `L
Data 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0 `J
Data 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0 `S
Data 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0 `Z
Data 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0 `T
`------ Declare Variables --------
global dim Board(10,24) as Integer `Array keeps track of the game board
global dim Shapes(16,28) as Integer `Array holds information about shapes
global ShapeActive = 0 as Boolean `Controls whether a shape can be dropped
global Level = 1 as Integer `Keeps track of the level
global Lines = 5 as Integer `Lines required to level up
`Read the Shape data into the Shapes Array
for a = 1 to 28
for b = 1 to 16
Read Shapes(a, b)
next b
next a
`Initialize the board by clearing it.
for a = 1 to 10
for b = 1 to 24
Board(a, b) = 0
next b
next a
`------ Create Bitmaps --------
`Load the bitmap with the blocks in it.
load bitmap "gfx\blocks.bmp", 32
`Each bitmap is a 28x28 square
for a = 1 to 7
create bitmap a, 28, 28
next a
`Copy each colored tile into its own bitmap.
for x = 0 to 6
tx = x * 28
copy bitmap 32, tx, 0, tx + 27, 27, x + 1, 0, 0, 27, 27
next x
`------ Main Game Loop --------
repeat
If ShapeActive = 0 Then
DropShape(1)
endif
DrawBoard()
until escapekey()
end
`------ Functions --------
function DropShape(shape)
` This function will draw a piece at the top of the grid based on
` the input it receives about what piece it should draw
for x = 1 to 4
for y = 1 to 4
If Shapes(x * y, shape) <> 0 then
Board(x + 4, y) = shape
endif
next y
next x
ShapeActive = 1
endfunction
function DrawBoard()
` This function will redraw squares on the game board when
` shapes move around.
for x = 1 to 10
for y = 1 to 24
tx = x * 28 + 260
ty = y * 28 + 40
if Board(x, y) <> 0 Then
copy bitmap Board(x, y), 0, 0, 27, 27, 0, tx, ty, tx + 27, ty + 27
endif
next y
next x
endfunction