3.10Summary
In this chapter, you have learned a lot of classes that will be useful in future projects. Unit testing is also an important knowledge point. It is a good choice to start game development by writing unit tests. This chapter introducesBreakoutGame. This chapter contains a lot of content, but fortunately you can skip someBreakoutGame knowledge points, because many parts can be reused in the previous chapterPongGame.
The next chapter focuses on game programming and describes how to use components to build a game. This chapter describes the benefits of using helper classes. You need to introduce this idea to actual games.CodeThis is very important for more complex games.
The following is a summary of this chapter:
-
- Use as many helper classes as possible to encapsulate the code that will be used multiple times into methods or helper classes.
-
- Write the unit test first, and then perform the specific implementation.
- Unit testing should be simple. You do not have to waste time designing unit tests that are complex for helper classes, or design static unit tests that are more complex than the game itself. Unit testing is not important for the final game (you can use# If debugCommand to exclude them), they just make your work easier, help you test and reuse new and old code.
-
- Each time you modify the code, you must run the unit test to ensure that no problem exists:
-
- UseTestdriven. netRun a single test, or run each test in each class or namespace in Solution Explorer
- Or useNunit GuiTestProgramAll unit tests in a set. For static unit tests, useProgramClass for manual testing
-
- Test the most complex parts of the game as much as possible, suchBreakoutCollision Detection in games