Book Image

Android Game Programming by Example

By : John Horton
Book Image

Android Game Programming by Example

By: John Horton

Overview of this book

Table of Contents (18 chapters)
Android Game Programming by Example
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
7
Platformer – Guns, Life, Money, and the Enemy
Index

Summary


We finished the platform game because that is all there is space for. Why not try to implement some or all of the following improvements and features?

Change the code in the Player class to make Bob gradually accelerate and decelerate instead of always running at full speed. Simply increment the velocity for each frame that the player is holding down left or right, and decrement it for each frame they are not.

Once you have achieved this, add the preceding code to the collision detection switch block in the update method to make the player skid on snow, speed up on concrete, and have a different walking/landing sound effect for each tile type.

Draw a gun on Bob, and adjust the height that the Bullet object is spawned at to appear as if it is coming from the barrel of his machine gun.

Make some objects pushable. Add an isPushable member to GameObject and make the collision detection simply knock the object back a little. Perhaps, Bob could push mine carts into fire to jump over extra...