Archived

This topic is now archived and is closed to further replies.

Le0

Something i dont understand with teej tutorial

Recommended Posts

Well im at the point where he asked me to make a tetris im actually working on making the pieces spawn at top, something i dont understand though is how he managed the pieces.dat file :
0100 0000 0100 0000
0100 1111 0100 1111
0100 0000 0100 0000
0100 0000 0100 0000

0000 0000 0000 0000
0220 0220 0220 0220
0220 0220 0220 0220
0000 0000 0000 0000

0000 0000 0000 0000
0300 0300 3330 0300
3330 0330 0300 3300
0000 0300 0000 0300

0400 0000 4400 0040
0400 4440 0400 4440
0440 4000 0400 0000
0000 0000 0000 0000

0050 0000 0550 0000
0050 0500 0500 5550
0550 0555 0500 0050
0000 0000 0000 0000

0000 0600 0000 0600
0660 0660 0660 0660
6600 0060 6600 0060
0000 0000 0000 0000

0000 0070 0000 0070
7700 0770 7700 0770
0770 0700 0770 0700
0000 0000 0000 0000
 
what i cant make up is some pieces first row are only 0, but some got pieces in the first row, my problem is i cant figure out how to place the piece at the top of the game screen without having a space for some pieces like the last one for instance.

Share this post


Link to post
Share on other sites
For the .dat file, each group is the same shape except rotated in 4 different ways. It''s somewhat disguised with shape 02 because it''s a square that looks the same rotated 4 different ways.

Also note the pattern
0000 0000 0000 0000
this is a separator between each separate piece that tells you to stop recording the current shape and get ready to store the next piece. It''s a type of delimiter that allows you to have variable size shapes. For a small program with such a small data set it might not be necessary; but it''s good to know the principle. A lot of 3d data files are have delimiter tests because 3D shapes have to vary from one 3D object to the next.

Now that you have the pattern you should write out the Pseudo-code.

Part of programming games and other programs is to step back from typing and to recognise patterns. If you''ve got a pattern, you have an algorithm.

ZoomBoy
Developing a iso-tile 2D RPG with skills, weapons, and adventure. See my old Hex-Tile RPG GAME, character editor, diary, 3D Art resources at Check out my web-site



Share this post


Link to post
Share on other sites