Kobold2D v1.0.1 now available!

On December 15, 2011, in Kobold2D, by Steffen Itterheim

Kobold2D v1.0.1 is now available from the Kobold2D Download page or via github! You’ll find the Release Notes in the usual place.

The most important new features are:

Almost all bugs reported so far have also been squashed. Mainly several fixes related to KKInput, a crash with CCMenuItem* and blocks and an issue that caused Retina mode not being properly enabled.

A few minor convenience methods have also been added, for example CCDirector now has a continuously updated frameCount property that returns the number of frames drawn since the app started, and KKInput now has the anyTouchLocation property if you just want the touch location of any (the) finger on the screen.

Detecting collisions on pixel-perfect boundaries is the holy grail of collision detection in 2D games. As such, it seems like the ideal, if not to say perfect, solution to collision detection in general. Yet, it’s also quite complicated and the straightforward solutions don’t perform very well until you start optimizing the code.

This first post focuses on creating a pixel mask by analyzing the raw image data, as proposed over 3 years ago by Ernesto Corvi. It’s the fastest solution if you want to test if a point collides with a pixel on an image, which also works for rotated and scaled sprites. However it does take some optimizing to speed up detecting collisions between a bounding box of a node and the pixel mask, or two pixel masks.

The alternative solution is to render the two colliding objects onto a CCRenderTexture, as developed by Dani and others on the Cocos2D forum. It is able to detect collisions of arbitrarily rotated and scaled sprites but can be expected to be noticeably slower than a pixel mask. I will discuss this solution in a future iDevBlogADay post.

The results will find their way into Kobold2D, to make the solutions readily available to all developers.

Continue reading »