Skip to main content

Game Physics

  • Chapter
  • First Online:
  • 2163 Accesses

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

Chapter
USD   29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD   69.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD   89.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Learn about institutional subscriptions

Author information

Authors and Affiliations

Authors

Rights and permissions

Reprints 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

Publish with us

Policies and ethics