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

Similar book on Amazon
XNA Game Studio 4.0 Programming: Developing for Windows Phone 7 and Xbox 360 (Developer's Library)
XNA Game Studio 4.0 Programming: Developing for Windows Phone 7 and Xbox 360 (Developer's Library)
Learning XNA 3.0: XNA 3.0 Game Development for the PC, Xbox 360, and Zune
Learning XNA 3.0: XNA 3.0 Game Development for the PC, Xbox 360, and Zune
Beginning XNA 2.0 Game Programming: From Novice to Professional (Expert's Voice in Game Programming)
Beginning XNA 2.0 Game Programming: From Novice to Professional (Expert's Voice in Game Programming)
Microsoftu00ae XNAu00ae Game Studio 3.0: Learn Programming Now! (Pro - Developer)
Microsoftu00ae XNAu00ae Game Studio 3.0: Learn Programming Now! (Pro - Developer)

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