Game Development Reference
In-Depth Information
In this example, the finally part saves you from copying code. Regardless of whether there was an
error while communicating with the server, you need to close the connection when you're done.
To conclude, Figure 20-2 shows a syntax diagram for the expressions related to exceptions. Try to
think of other examples in the games you've seen until now where exceptions could be useful.
exception
try
block
catch
(
name
)
block
finally
block
throw
expression
;
Figure 20-2. Syntax diagram of expressions related to exceptions
What You Have Learned
In this chapter, you have learned:
How to define different game states using a game-state manager
How to switch between game states depending on the player's actions
How to properly deal with errors in games by using exceptions
 
 
Search WWH ::




Custom Search