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

Chapter 3. Tappy Defender – Taking Flight

We are now ready to quickly add a lot of new objects and some features as well. By the end of this chapter, we will be really close to a playable game. We will detect the player touching the screen, so he can control the spaceship. We will add virtual boosters to our SpaceShip class to move the ship up and down and increase the speed.

We will then detect the resolution of the Android device and use it to do things like prevent the player boosting off the screen, and to detect when our enemies need to respawn.

We will create a new EnemyShip class, which will represent the suicidal enemies. We will also see how we can easily spawn and then control them without changing any of the logic from the control part of our code.

We will add a scrolling effect by adding a SpaceDust class and spawning dozens of them to make it look like the player is whizzing through space.

Finally, we will learn about, and implement, collision detection so we know when our player has been hit by an enemy, as well as look at a graphical trick to help us with debugging our collision detection code.

主站蜘蛛池模板: 安阳县| 平泉县| 西充县| 探索| 沂南县| 南澳县| 米易县| 闽清县| 怀化市| 普陀区| 侯马市| 思茅市| 辉南县| 叶城县| 徐闻县| 扶余县| 鄂州市| 祁东县| 大同市| 桐城市| 株洲市| 周口市| 新郑市| 宣恩县| 金溪县| 汉阴县| 博客| 安仁县| 曲水县| 凤山市| 辽阳县| 南投县| 浦县| 阿巴嘎旗| 彭阳县| 罗源县| 凌海市| 伊宁市| 万荣县| 威远县| 凌海市|