即时提出这个问题,因为我试图在我的平台游戏中进行有效的碰撞检测,我使用本教程使用的方法:http://as3gametuts.com/2012/01/08/platformer-3/
以下是无法使用的代码部分:
stage.addEventListener(Event.ENTER_FRAME, loop);
function loop(e:Event):void
{
if (ground.hitTestPoint(borat.x + leftBumpPoint.x,borat.y + leftBumpPoint.y,true))
{
trace("leftBumping");
leftBumping = true;
}
else
{
leftBumping = false;
}
if (ground.hitTestPoint(borat.x + rightBumpPoint.x,borat.y + rightBumpPoint.y,true))
{
trace("rightBumping");
rightBumping = true;
}
else
{
rightBumping = false;
}
if (ground.hitTestPoint(borat.x + upBumpPoint.x,borat.y + upBumpPoint.y,true))
{
trace("upBumping");
upBumping = true;
}
else
{
upBumping = false;
}
if (ground.hitTestPoint(borat.x + downBumpPoint.x,borat.y + downBumpPoint.y,true))
{
trace("downBumping");
downBumping = true;
}
else
{
downBumping = false;
}
其中ground是舞台上动画片段的实例名称
我收到此错误:
1046: Type was not found or was not a compile-time constant: ground.
感谢所有阅读此内容的人