Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Tetris tutorial
#1
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   tetris_tutorial.zip (Size: 105.44 KB / Downloads: 21)
Reply
#2
The second step of the tutorial has been added. In this step, the game grid is defined and some graphics from opengameart.org is added.

The zip in the original post has been updated.
Reply
#3
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:

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

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)