Game Development Community

detect object collision and perform function based on collision

by rory sampson · in General Discussion · 04/06/2011 (12:40 am) · 2 replies

howdy,

Need some assistance with writing functions for a "blockClass" in a game i am working on,
blocks from this class are constantly being spawned from a point at the top of the screen, these blocks fall and depending on what they collide with a different action will be performed, these "actions" are rather simple but im not sure how to check a collision on another object

e.g

if( block collides with player)
{
lets do a barrel roll;

}else
if (block collides with floor)
{
freak out;
}
hope this is clear and that i have posted in the right spot.

About the author

game developer/student/copy paste programmer


#1
04/06/2011 (6:22 am)
::onCollision(). If you do a search in the demo projects, you'll find several places you can look at for where it happens.
#2
04/06/2011 (7:36 am)
@Rory - Read this doc. It was written for iTorque 2D, but it is applicable to Torque 2D: Collision System