Challenge: Create the NextBlock Game Component


This chapter did not really talk about the NextBlock game component and there is a reason for that. I want you to create it yourself. In the source code for this book the NextBlock class is empty and you have the task of filling it with life. The NextBlock game component is already added to the TetrisGrid class and you already saw all the available methods. If you are unsure about your solution you can check the complete source code with all the improvements and the full NextBlock class I made in the XNA Tetris full project source code, but I recommend you try coding the game component and maybe some other improvements to the game yourself to get more familiar with all the new classes.

The NextBlock component should show the next block type. Just use the BlockTypes enum from the TetrisGrid class and display the next block in a 5×5 grid and add a little text on top (see Figure 4-11).

image from book
Figure 4-11

A little tip: Don’t waste too much time playing Tetris. It is a great game, but you have more to come in this book.




Professional XNA Game Programming
Professional XNA Programming: Building Games for Xbox 360 and Windows with XNA Game Studio 2.0
ISBN: 0470261285
EAN: 2147483647
Year: 2007
Pages: 138

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net