Processing other codes

Now that we have implemented a method that allows the player to be killed, we can handle the final outstanding pre-defined code value—DEAD. This code makes entering the marked square lethal to the player. We will implement this code by building a helper method that will examine the current cell's code value and take appropriate action.

If you define additional code values, you can expand on this method to react to them appropriately.

Get XNA 4.0 Game Development by Example Beginner's Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.