官术网_书友最值得收藏!

Game Objects and the Game Loop

In this chapter, we will begin to put the framework of a game into place. All games have game objects and a game loop. A game loop exists in every game ever written. Some tools, such as Unity, do their best to abstract away the game loop so that the developer does not necessarily need to know it is there, but even in these cases it still is. All games must take some control over the rendering capabilities of the operating system or hardware it is running on and draw images out to the screen while the game is running. All of the work of the game is done within a big loop. Game objects can be either an instance of classes in the case of Object-Oriented Programming (OOP) languages such as C++, or in the case of procedural languages such as C, they could be loose collections of variables or structures. In this chapter, we will be learning how to design a game loop and some early versions of our game objects from within C++ compiled into WebAssembly.

You will need to include several images in your build to make this project work. Make sure you include the /Chapter06-game-object/sprites/ folder from the project's GitHub repository. If you haven't yet downloaded the GitHub project, you can get it online here:  https://github.com/PacktPublishing/Hands-On-Game-Development-with-WebAssembly.

In this chapter, we will cover the following topics:

  • Game loops
  • Object pooling
  • Player game object
  • Enemy game object
  • Projectiles
主站蜘蛛池模板: 深泽县| 射洪县| 奉节县| 锡林郭勒盟| 衡阳县| 古蔺县| 舒城县| 呼玛县| 葫芦岛市| 杨浦区| 大石桥市| 泌阳县| 随州市| 汉川市| 宝坻区| 墨江| 台东县| 翁源县| 桓台县| 克什克腾旗| 城固县| 柏乡县| 六盘水市| 阳信县| 昌黎县| 曲阜市| 德令哈市| 北海市| 维西| 翁牛特旗| 韶山市| 云浮市| 水城县| 东乌| 南投县| 东宁县| 高邮市| 沂水县| 施秉县| 泸西县| 重庆市|