Wow, this brings back a few memories. I wrote a Tetris clone using a DOS based BASIC variant (can't remember the name, but it was an editor/compiler instead of an interpreter) during lulls in class at college.
I can't remember too much but I can remember it was quite straightforward.
I defined the shapes (and all rotations of the shapes) as arrays and read them in using Read/Data
I think the array itself was laid out as shapes(shape,angle,x,y)
Where shape was the ID of the shape (The 'L', the 'I', the 'S' etc), angle was 0-3 for the 4 possible rotations of a shape (I know, some shapes only looked different in 2 rotations, but this was a quick and dirty code). X and Y were the 'grid' of the shape, eg: -
0,0,0,1
0,0,1,1
0,0,1,0
0,0,0,0
I defined the playing area as a 2D array. A zero meant no block was present, a one meant there was.
It was really quite simple after that. You store the current shape's X and Y (relative to the playing grid array) and you check to see what is underneath your shape on in the playing grid array.
Perhaps this should be a community project? ;)
I can't remember too much but I can remember it was quite straightforward.
I defined the shapes (and all rotations of the shapes) as arrays and read them in using Read/Data
I think the array itself was laid out as shapes(shape,angle,x,y)
Where shape was the ID of the shape (The 'L', the 'I', the 'S' etc), angle was 0-3 for the 4 possible rotations of a shape (I know, some shapes only looked different in 2 rotations, but this was a quick and dirty code). X and Y were the 'grid' of the shape, eg: -
0,0,0,1
0,0,1,1
0,0,1,0
0,0,0,0
I defined the playing area as a 2D array. A zero meant no block was present, a one meant there was.
It was really quite simple after that. You store the current shape's X and Y (relative to the playing grid array) and you check to see what is underneath your shape on in the playing grid array.
Perhaps this should be a community project? ;)