0

我问这个问题是因为我试图在我的平台游戏中进行有效的碰撞检测,我使用本教程使用的方法: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. 

感谢所有阅读本文的人

4

0 回答 0