Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Tetris tutorial
The zip attached to this post contains all the steps of the tutorial written (so far).

There are two versions of each source code file in the zip, one ending with .nala and one with .txt. They're identical, but NED on Linux only does syntax highlighting on files ending with .nala, and the Windows version of the compiler expects the file ending to be .txt. Just saving you from all the trouble of changing the filename.

Ask if anything is unclear, looks weird or needs further explaining Smile

Attached Files
.zip (Size: 105.44 KB / Downloads: 21)
The second step of the tutorial has been added. In this step, the game grid is defined and some graphics from is added.

The zip in the original post has been updated.
The third step of the tutorial has been added. Now falling blocks are spawned that the player can move (but yet not rotate), and the game over condition has been implemented.

You could easily allow rotation of the falling blocks by adding this code:

' Try rotate?
if keydown(VK_SPACE, true)
    if BlockPositionValid(block, (angle + 1)%4, xBlock, yBlock)
        angle = (angle + 1)%4

right after the block movement controls (line 115 or so). But this is not the complete solution, which will be shown in the next step of the tutorial.

The zip in the original post has been updated.

Forum Jump:

Users browsing this thread: 1 Guest(s)