I'm using a blitting engine that uses bitmapData. No display objects.
Is there a fast pixel perfect collision detection available for such a game system?
I already tried CDK but that didn't work because it assumes you have display objects which my objects don't use. Sometimes my objects are pretty big and hitTest sucks in this case. I already tried circle-to-circle collisions but that didn't do the trick either. Any help or hints?
Update:
public function renderTile(canvasBitmapData:BitmapData):void
{
x = nextX;
y = nextY;
point.x = x;
point.y = y;
if (animationCount >= animationDelay)
{
animationCount = 0;
if(reverse)
{
currentTile--;
if (currentTile < 1)
{
currentTile = tilesLength - 1;
}
} else {
currentTile++;
if (currentTile == tilesLength)
{
currentTile = 0;
}
}
} else {
animationCount++;
}
canvasBitmapData.lock();
tileRect.x = int((currentTile % spritesPerRow)) * tileWidth;
tileRect.y = int((currentTile / spritesPerRow)) * tileHeight;
bitmapData = new BitmapData(tileWidth - oversize, tileHeight - oversize, true, 0x000000);
canvasBitmapData.copyPixels(tileSheet, tileRect, point);
canvasBitmapData.unlock();
}
Calling hitTest:
if (player.bitmapData.hitTest(player.point, 255, tempAsteroid.bitmapData, tempAsteroid.point, 255))
Currently the collisions do not work at all. I can fly through my objects and I get absolutely no collisions. I read somewhere that flash player standalone v10.1 had issues with bitmapData.hitTest but I'm using 10.3 so this should be not the problem.