Page 33/36 setVector(absPos, Children[i].AbsolutePosition); if (absPos[2] – 1) < FloodLevels[Round(absPos[0])] then This code fragment detects if the cube iterated by Children[i]  is lower then value stored in FloodLevels  field. Absolute position of the cube is stored in  absPos  variable. This is important because absolute position is real position in world coordinate system while  Position  is position relative to the parent. Which member of FloodLevels field is to be compared against is determined by rounding absolute X position of the cube. If the cube rests on ground or other cube,  Active property is set to false, we add points to score and program is informed that another cube can be created. To respond to user actions we check which T3DTInput status is active and do the task: case Form1.UserInput of inpMoveL: Slide(-1); inpMoveR: Slide(1); inpRotateL: Pitch(-90); inpRotateR: Pitch(90); end; Slide and Pitch functions are GLScene functions to move and rotate objects. Now we should check for collisions again and undo the movement or rotation if the new position of block is not valid. The last thing is to detect if the game is over. This can be done in cadencer progress event. We can simply check FloodLevels if any value is over 20. If it is so disable cadencer and display massage with number of points achieved and game over information. Homework This is it. With some tweaking that is all you need to make Tetris game. I chose this example to show you how powerful GLScene is. Not only that you can set up all game environment design time. You take advantage of functions that move and rotate objects together with their children. The code to copy this behaviour would be quite complex. In the last paragraph I will give you more ideas to think about to make the game better. ·    Make some interface. The program needs menus desperately. Use standard Delphi or GUI components. ·    Let the game be restartable with levels and increasing difficulty – game speed. ·    Make real collisions with collision manager and let the blocks rotate and slide smoothly. That would require more advanced solutions: can the block collide while rotating? ·    Add sound and music. Player should hear sound feedback for his actions. ·    Make it customizable – graphics, sound, keyboard options, size of playing field and blocks. ·    Make score table with best results together with player’s name that is saved. ·    Make it look prettier. Put different textures on blocks. Add particle effects, sky box, lens flare. The game can take place in a canyon with bridge above. Passing cars or trains would drop blocks. Or King-Kong on top of two skyscrapers can throw the blocks down. The limit is only your imagination. ·    Add the third dimension to the game play. But be careful! Many 3D remakes of old 2D games were not successful because they became too complicated and difficult to play. You should   thing   carefully   about   camera   controls.   The   game   can   pause   during   camera GLScene beginner's guide, Jan Zizka, 2005