Collisions

Mithat Konar

February 29, 2016

Collisions

Collecting raindrops

Download starter project

The following examples show how to use a Sprite’s intersect method to see if it has collided with something.


  

Run | Raw code


  

Run | Raw code | Differences


  

Run | Raw code | Differences


  

Run | Raw code | Differences

Killer smile

Download starter project

The following examples show that collisions work in two dimensional play as well. They also demonstrate some additional concepts like bouncing, wrapping, and random direction at constant speed.

Bouncing smiles


  

Run | Raw code


  

Run | Raw code | Differences


  

Run | Raw code | Differences

Meandering smiles


  

Run | Raw code | Differences


  

Run | Raw code | Differences

Shooting

Shooting is a particular case of collision. There is a supplemental example showing you how to do it.