Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Mastering iOS Game Development

You're reading from   Mastering iOS Game Development Mastering iOS Game Development

Arrow left icon
Product type Paperback
Published in Dec 2015
Publisher Packt
ISBN-13 9781783554355
Length 228 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Authors (2):
Arrow left icon
Peter Ahlgren Peter Ahlgren
Author Profile Icon Peter Ahlgren
Peter Ahlgren
Miguel DeQuadros Miguel DeQuadros
Author Profile Icon Miguel DeQuadros
Miguel DeQuadros
Arrow right icon
View More author details
Toc

Collision detection

We all know that collision detection is imperative to any game. Regardless of whether it's a hockey game, or Call of Angry eight year olds, the game needs to detect collisions of hockey pucks, bullets, swords, feet on the ground—you name it and there are a ton of collisions that need to be detected. For our game, we are only going to detect simple boxes colliding with each other between the player and enemies, the platforms, and the bullets colliding with enemies.

We are going to make things super easy; first we are going to detect the player's bounding box.

Note

What's a bounding box? Simple! Think of when you're creating your sprites; there's a box surrounding your image? You could think of a collision bounding box like that, the small box that your sprite fits in or within a defined space. You can (and we will) adjust the size of the bounding box to fit the sprite; you can have it larger or smaller depending on your needs.

With that all...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime