Chapter 2 create the first game-pong
2.1 Overview of this Chapter
This chapter mainly discusses how to design and create a simple pong game. Pong was a video game a long time ago. Even before the first batch of Pong versions appeared in, a version was available for playing in Oscilloscope (William. tennis for two created by higinbotham), which means it is easy to implement a basic pong game. A TV engineer named Ralph Baer claimed that he had the idea of implementing pong games as early as 1951, but he did not create the first prototype until 1966. Atari registered the pong game in 1980s and filed a lawsuit with another company claiming that Pong was the first to be invented, it would be crazy to go to court for such a simple game today. If you want to know the whole story of Pong you can visit the www.pong-story.com.
It won't take much time to implement a very simple Pong clone version, but you still have to learn about the sprite class of xNa in this chapter. You will start by writing a game idea and go through a complete game project design phase. You can continue to do so in future projects. After a while, you do not have to write the game conception process first, this is because you can naturally come up with these ideas during the first unit test. Then, you will learn an effective way to manage and use the game's textures, and modify and adjust your game to make it more interesting and support dual-player combat, it can even be tested on the Xbox 360 platform.
Although this chapter focuses on pong games, it is not all you have learned. pong games are mostly used to learn agile methodologies, this will be introduced later in this chapter. You will learn why it is important to write unit tests first, and design the game in advance and then improve it step by step, in the following chapters, you will also use unit tests for other classes. For this game, you only need a simple class and then use several unit tests at the end to test plotting, collision, and correctly locate everything.
The unit tests used in this chapter are all static unit tests (static unit tests). In the next chapter, you will learn dynamic unit tests (dynamic unit tests ). The difference is that you need to manually start the static unit test and check whether the result is correct based on the screen output, dynamic unit testing uses a unit testing framework such as nunit to automatically perform operations. For more information about the unit test framework, see Chapter 3.