I haven't fully read the OP question. Was it a Tetris game? If yes, then the code OP showed us has many missing parts:
- Standard Tetris has 7 tetrominosMore info:
https://en.wikipedia.org/wiki/Tetris#GameplayOP need to create a container to store all the tetromino data. It can be a list of TList of x/y points, a list of 2 dimensional array of Boolean, array[0..6] of TList, array[0..6] of 2 dimentional array of Boolean or whatever s/he feels convenient.
- Global variablesIt should store the value of Current_Tetromino_Model and Current_Tetromino_Rotation
To check if the tetromino need to respawn:
If (Current_Tetromino_Y <= 0) or DetectCollision(Current_Tetromino_Model, Current_Tetromino_Rotation, Current_Tetromino_Position) then
And this how the DetectCollision works:
1. Get the tetromino data that stored previously in the container based on Current_Tetromino_Model
2. Rotate the data based on the Current_Tetromino_Rotation
3. Move the tetromino based on Current_Tetromino_Position
4. Compare the final result with the game world, if right below the each of the tetromino's blocks are empty then it Return := False; (which means it is not blocked)
And if you want each tetromino to has its own color, thing will become a bit more complicated.
Sorry to say, but I think creating a Tetris game is too hard for the OP. It is lots easier to create a snake game, which is much simpler.
Anyway, I remember a senior here Eny ever posted a Tetris game, he named it
Petris. It was about 600 LOC, well written. You can try to search it if you want to see the source code.