Skip to main content

Tile-Based Collision

  • Chapter
  • First Online:
Book cover The Advanced Game Developer's Toolkit
  • 1236 Accesses

Abstract

There are two main ways that you can check for collisions in games. The first is to compare the x and y pixel positions of sprites on the screen. If their shapes are overlapping, you have a collision. This is a collision detection strategy called narrow-phase collision. If you’ve used a game engine with collision functions that might have names like hitTestRectangle or hitTestCircle to check whether shapes are overlapping, it’s likely that these are narrow-phase collision functions. They use vector math (linear algebra) to figure out if the shapes of the sprites are overlapping. Because of that you can achieve very precise pixel-level collision accuracy, which is very important for physics-based action games.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 54.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 69.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

Institutional subscriptions

Author information

Authors and Affiliations

Authors

Rights and permissions

Reprints and permissions

Copyright information

© 2017 Rex van der Spuy

About this chapter

Cite this chapter

van der Spuy, R. (2017). Tile-Based Collision. In: The Advanced Game Developer's Toolkit. Apress, Berkeley, CA. https://doi.org/10.1007/978-1-4842-1097-0_3

Download citation

Publish with us

Policies and ethics