Reader small image

You're reading from  Android Game Programming by Example

Product typeBook
Published inJun 2015
Reading LevelIntermediate
Publisher
ISBN-139781785280122
Edition1st Edition
Languages
Tools
Right arrow
Author (1)
John Horton
John Horton
author image
John Horton

John Horton is a programming and gaming enthusiast based in the UK. He has a passion for writing apps, games, books, and blog articles. He is the founder of Game Code School.
Read more about John Horton

Right arrow

Things that go bump – collision detection


Collision detection is quite a broad subject. Throughout the three projects in this book, we will use a whole range of different ways to detect when things collide.

So, here is a quick look at our options for collision detection, and in which circumstances different methods may be appropriate.

Essentially, we just need to know when certain objects from our game touch other objects. We can then respond to that event by exploding, reducing shields, playing a sound, or whatever is appropriate. We need a broad understanding of our different options so we can make the right decisions in any particular game.

Collision detection options

First of all, here are a few of the different mathematical calculations we can utilize and when they may be useful.

Rectangle intersection

This type of collision detection is really straightforward. We draw an imaginary rectangle; we can call it a hitbox or bounding rectangle, around the objects we want to test for collision....

lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Android Game Programming by Example
Published in: Jun 2015Publisher: ISBN-13: 9781785280122

Author (1)

author image
John Horton

John Horton is a programming and gaming enthusiast based in the UK. He has a passion for writing apps, games, books, and blog articles. He is the founder of Game Code School.
Read more about John Horton