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

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.

主站蜘蛛池模板: 灵石县| 庄浪县| 名山县| 阳谷县| 兰西县| 博罗县| 十堰市| 嘉义市| 石楼县| 德钦县| 横山县| 莱西市| 南乐县| 金华市| 兴隆县| 扎兰屯市| 潍坊市| 锦州市| 禹州市| 二连浩特市| 繁昌县| 黔江区| 梅河口市| 乌兰县| 华蓥市| 晴隆县| 武义县| 颍上县| 古蔺县| 天镇县| 丁青县| 长汀县| 台南县| 谢通门县| 修文县| 翼城县| 连南| 磐石市| 全州县| 柳州市| 县级市|