Abstract
In the previous chapter, you saw how to create an animated character. You also saw how you can load levels and level status from the local storage and how to build a tile-based game world. One of the most important aspects is still missing: defining how the character interacts with the game world. You can make a character move from left to right, but if you simply place the character in the level, it can only walk on the bottom of the screen. This isn’t enough. You want the character to be able to jump on top of wall tiles and fall down if it moves off a wall tile, and you don’t want the character to fall off the edge of the screen. For these things, you need to implement a basic physics system. Because it’s the character interacting with the world, you implement this physics in the Player class. There are two aspects to dealing with physics: giving the character the ability to jump or fall, and handling collisions between the character and other game objects and responding to these collisions.
This is a preview of subscription content, log in via an institution.
Buying options
Tax calculation will be finalised at checkout
Purchases are for personal use only
Learn about institutional subscriptionsAuthor information
Authors and Affiliations
Rights and permissions
Copyright information
© 2014 Arjan Egges
About this chapter
Cite this chapter
Egges, A. (2014). Game Physics. In: Building JavaScript Games. Apress, Berkeley, CA. https://doi.org/10.1007/978-1-4302-6539-9_26
Download citation
DOI: https://doi.org/10.1007/978-1-4302-6539-9_26
Published:
Publisher Name: Apress, Berkeley, CA
Print ISBN: 978-1-4302-6538-2
Online ISBN: 978-1-4302-6539-9
eBook Packages: Professional and Applied ComputingProfessional and Applied Computing (R0)Apress Access Books