Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I am trying to make a collision between a sprite and an animated sprite. The animated sprite is the main character of the game. The problem I am facing is that when another sprite collides with the main character, it collides with the transparent bounding area around the character. How should I perform collision detection between the actual pixels of the character and any other obstacle sprite?

share|improve this question
1  
I read somewhere that when working with the PhysicsBox2DExtension, you can create a Body that has the outline of your actual Sprite content. Can someone guide me on how to do so? –  Swati Rawat Jul 12 '12 at 6:06
    
possible duplicate of How do I detect pixel-level collision using andEngine? –  Byte56 Jul 12 '12 at 13:04
add comment

2 Answers 2

If your game need real world collision detection then you have to use box2d provided by andengine then after you do not have to worry about the collision. Because body for your different shapes have been created.

EDIT : For the purpose of pixel perfect collision detection the following link can help you that I think.

http://qwerjk.com/pixel-perfect/

In which they show demo and also provide example.

share|improve this answer
    
-1. That doesn't answer the question. Box2D provides collision-detection (you could even use only the collision-detection part and skip the physics-simulation entirely), but it doesn't do pixel-perfect collision detection, which is what was asked for. –  bummzack Jul 14 '12 at 8:12
    
that -1 is not fair... is a good answer... in general, pixel perfect collision for a game is a bad idea, is far better using several boxes or circles to improve perfomance, to know with part of the body collides, etc... and if you are using a engine that provide it... it should be used –  Blau Jul 21 '12 at 9:16
    
Removed the downvote, as the answer was improved. –  bummzack Jul 21 '12 at 9:30
add comment

AndEngine Collision Extension: https://github.com/MakersF/AndEngineCollisionsExtension This is an extension that aims to bring different collision methods (perfect or approximations) to AndEngine GLES2

Supported Collision Methods: Pixel-Perfect Collision (supports: translation, scale, rotation, screw) It also support pixel-perfect collision between pixel-perfect shapes and retangular shapes, without the need for the latter to be a pixel-perfect shape. Alpha values different from 0 (you set the threshold that identify if a pixel is solid or not) You ca unse the utils methods to check the performances in your app or to output the collision mask to check if it is what you need

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.