How to design 2D collision callback methods?
Posted
by
Ahmed Fakhry
on Game Development
See other posts from Game Development
or by Ahmed Fakhry
Published on 2012-10-10T06:09:03Z
Indexed on
2012/10/10
9:53 UTC
Read the original article
Hit count: 172
In a 2D game where you have a lot of possible combination of collision between objects, such as:
object A vs object B => object B vs A;
object A vs object C => object C vs A;
object A vs object D => object D vs A;
and so on ...
Do we need to create callback methods for all single type of collision? and do we need to create the same method twice? Like, say a bullet hits a wall, now I need a method to penetrate the wall for the wall, and a method to destroy the bullet for the bullet!!
At the same time, a bullet can hit many objects in the game, and hence, more different callback methods!!!
Is there a design pattern for that?
© Game Development or respective owner