background preloader

Cocos2d for iPhone

Cocos2d for iPhone

Zoom effect cocos2d extensions repeating background Box2D Tutorial: Collision filtering | Aurelien Ribon's Dev Blog Hello, Today I want to make a tutorial about collision filtering in the Box2D engine, because it is something that is not that easy to master, and yet it is a very powerful and useful feature. Note: examples and source code are related to the LibGDX (Android) implementation of the Box2D API, but the concepts are the same for any other implementation, only the syntax may differ. There are two ways to deal with collision filtering: by using categories and masks, or by using groups. Illustration example To illustrate collision filtering, let’s take an example: we have three kinds of objects in a simple platformer game: players, monsters, and scenery. We want the following rules: players should not collide with each others, neither do monsters, but players should collide with monsters (and vice-versa). Filter categories and masks Categories and masks are the most powerful way to deal with collision filtering, but also the most complicated for newcomers. Wait, 0×001, 0×002 and 0×004 ? Conclusion

Related: