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 ...

Get Android Game Programming by Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.