Near pixel-perfect spritesheet collisions

Hello,

Let’s say I have a horse that is running, and it is a spritesheet. And player with his control makes it jump over obstacles (more sprites). When the horse hits the obstacles the game is over.

But the horse is not one sprite… it is a lot of sprites. And I have to calculate the collision for each sprite. In fact I don’t know how to do it even for one sprite cause I don’t know any free program to do near pixel-perfect bounding box collision. So:

  1. Is there a free app where I can calculate all the coordinates of my one graphic’s custom bounding box and then add them in my addBody table?

  2. Is there a way to do this for all the sprites in the spritesheet?

Thank you.

If this is a simple jumping game like lets say flappy bird then pixel-perfect collisions are an overkill. Pick just some characteristic points and detect collisions with them.

Can you elaborate on this please? How do I do this on a spritesheet?

I have the legs and neck that can collide while running, or the legs while jumping or landing with obstacles, or the head and neck while collecting varius floating items. All these in different sprites.

Don’t collide with sprites. Create invisible circles (display.newCircle()) and use them as sensors that will do the collision detection. You can move them with your object on enterFrame event Also read about Collision Filters: http://forums.coronalabs.com/topic/2128-collision-filters-helper-chart/

Thanks a lot for your help! I think I got what you re saying.

You can also add multiple shapes to your spritesheets physics body, which is a better approach than creating multiple display objects that act as sensors.

Hope this helps.

Physics editor is a tool that can aid in setting that up, although it is not free.

If this is a simple jumping game like lets say flappy bird then pixel-perfect collisions are an overkill. Pick just some characteristic points and detect collisions with them.

Can you elaborate on this please? How do I do this on a spritesheet?

I have the legs and neck that can collide while running, or the legs while jumping or landing with obstacles, or the head and neck while collecting varius floating items. All these in different sprites.

Don’t collide with sprites. Create invisible circles (display.newCircle()) and use them as sensors that will do the collision detection. You can move them with your object on enterFrame event Also read about Collision Filters: http://forums.coronalabs.com/topic/2128-collision-filters-helper-chart/

Thanks a lot for your help! I think I got what you re saying.

You can also add multiple shapes to your spritesheets physics body, which is a better approach than creating multiple display objects that act as sensors.

Hope this helps.

Physics editor is a tool that can aid in setting that up, although it is not free.