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

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.

主站蜘蛛池模板: 新巴尔虎右旗| 石台县| 桂平市| 正镶白旗| 慈溪市| 星子县| 信宜市| 红原县| 荆门市| 太和县| 宣恩县| 苏州市| 布尔津县| 康乐县| 龙海市| 大城县| 万州区| 松原市| 昂仁县| 南阳市| 崇信县| 吴桥县| 文登市| 浙江省| 望奎县| 普定县| 栾川县| 平塘县| 临西县| 南昌市| 睢宁县| 南平市| 肥西县| 仙居县| 靖西县| 萨嘎县| 河池市| 水富县| 武义县| 公安县| 汝城县|