I am new to cocos2d and I am using cocos2d lib in eclipse in java to make a game.I want to do a pixel collision.My game is a 2d game,a ball running in a maze, and i want to detect the collision between the maze wall and the ball, i cant use getpixel in CCSprite. So how can i do it? CCSprite.getpixel doesn't exsist. I only can do checking bounding box collision between two sprite..but don't know how to do pixel compare pixel point by point..
public boolean isCollisionDetected(CCSprite maze,CCSprite ball)
{
CGRect bounds1 = maze.getBoundingBox();
CGRect bounds2 = ball.getBoundingBox();
if( CGRect.intersects(bounds1, bounds2) ){
/* i want to do pixel detection in here,actually i want to do something like this
for (int i = collisionBounds.left; i < collisionBounds.right; i++) {
for (int j = collisionBounds.top; j < collisionBounds.bottom; j++) {
int sprite1Pixel = getBitmapPixel(sprite1, i, j);
int sprite2Pixel = getBitmapPixel(sprite2, i, j);
if( isFilled(sprite1Pixel) && isFilled(sprite2Pixel)) {
return true;
}*/
return true;
}
return false;
}
but Cocos2d, sprite doesn't support this kind of method.