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

Summary

In this chapter, we learned how to create a basic game framework. We learned what a game loop is and how we create one for WebAssembly using Emscripten. We learned about game objects and created classes to define our player's spaceship, an enemy spaceship, and projectiles. We learned about object pooling, and how we can use an object pool to recycle objects in memory so that we do not need to create and destroy new objects in memory continually. We used this knowledge to create an object pool for our projectiles. We also created an AI stub for our enemy spaceship that gave that object random behavior, and we created functions that let our player and enemy shoot at each other while our projectiles pass harmlessly through the spaceships. 

By the end of the next chapter, we will add collision detection; this will allow our projectiles to destroy the spaceships they hit, and add an animation sequence that will show a ship being destroyed when it is hit by one of the projectiles.

主站蜘蛛池模板: 商水县| 新乐市| 武隆县| 改则县| 贞丰县| 益阳市| 虞城县| 阿拉尔市| 兴仁县| 丹东市| 马关县| 南京市| 巴塘县| 景泰县| 防城港市| 会理县| 阿荣旗| 松江区| 将乐县| 平顶山市| 杂多县| 丰台区| 文安县| 白山市| 铁岭县| 鄂伦春自治旗| 齐河县| 郓城县| 孟津县| 西林县| 辛集市| 富裕县| 通化县| 阳泉市| 和静县| 资中县| 平潭县| 泗阳县| 乌兰察布市| 洪洞县| 类乌齐县|