【发布时间】:2011-10-23 22:47:12
【问题描述】:
我正在使用一个使用 bitmapData 的位图引擎。没有显示对象。
这样的游戏系统是否有快速的像素完美碰撞检测?
我已经尝试过 CDK,但没有奏效,因为它假定您有我的对象不使用的显示对象。有时我的对象非常大,在这种情况下 hitTest 很糟糕。我已经尝试过圆到圆的碰撞,但这也没有奏效。任何帮助或提示?
更新:
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();
}
调用 hitTest:
if (player.bitmapData.hitTest(player.point, 255, tempAsteroid.bitmapData, tempAsteroid.point, 255))
目前,碰撞根本不起作用。我可以飞过我的物体,而且绝对不会发生碰撞。我在某处读到 Flash 播放器独立 v10.1 与 bitmapData.hitTest 存在问题,但我使用的是 10.3,所以这应该不是问题。
【问题讨论】:
-
你用的是什么blitting引擎?
标签: actionscript-3 collision-detection