저는 cocos2d에 익숙하지 않습니다. 자바에서 eclipse로 cocos2d 라이브러리를 사용하여 게임을 만들었습니다. 픽셀 충돌을 원합니다. 내 게임은 2 차원 게임, 공 미로에서 실행하고, 나는 미로 벽과 공 사이의 충돌을 감지하고 싶습니다, 나는 CCSprite에서 getpixel을 사용할 수 없습니다. 어떻게해야합니까? CCSprite.getpixel은 제외되어 있지 않습니다. 난 단지How do to do cocos2d in android에서 감지 된 픽셀 충돌
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;
}
.. 픽셀을 점 픽셀 지점을 비교하는 방법을 모르는 두 sprite..but 사이의 상자 충돌을 경계 검사를 할 수 있지만적인 Cocos2D, 스프라이트는이 기능을 지원하지 않습니다 방법의 종류.
정확히 원한다면 –