HitTestPoint 不工作,没有发生碰撞
HitTestPoint not working, collisions not happening
我正在尝试创建类似于不可能的测验问题 5(第 1 个测验)的内容。但是 hitTestPoint 似乎没有读取。我不确定我的错误在哪里。
这是我的完整代码行。
stop();
blueTarget.addEventListener(MouseEvent.MOUSE_OVER, mousehandler2);
function mousehandler2(e:MouseEvent):void {
if (blueTarget.hitTestPoint(mouseX,mouseY,true)) {
removeEventListener(MouseEvent.MOUSE_OVER, mousehandler2);
gotoAndStop("lose");
}
}
nexttButton.addEventListener(MouseEvent.MOUSE_DOWN, mousehandler3);
function mousehandler3(e:MouseEvent):void {
removeEventListener(MouseEvent.MOUSE_DOWN, mousehandler3);
MovieClip(root).nextFrame();
}
感谢您的帮助!
你想让玩家把鼠标移到blueTarget 上就输吗?如果是这样,您可以删除 if
语句,因为鼠标悬停事件已经添加到 blueTarget
我正在尝试创建类似于不可能的测验问题 5(第 1 个测验)的内容。但是 hitTestPoint 似乎没有读取。我不确定我的错误在哪里。
这是我的完整代码行。
stop();
blueTarget.addEventListener(MouseEvent.MOUSE_OVER, mousehandler2);
function mousehandler2(e:MouseEvent):void {
if (blueTarget.hitTestPoint(mouseX,mouseY,true)) {
removeEventListener(MouseEvent.MOUSE_OVER, mousehandler2);
gotoAndStop("lose");
}
}
nexttButton.addEventListener(MouseEvent.MOUSE_DOWN, mousehandler3);
function mousehandler3(e:MouseEvent):void {
removeEventListener(MouseEvent.MOUSE_DOWN, mousehandler3);
MovieClip(root).nextFrame();
}
感谢您的帮助!
你想让玩家把鼠标移到blueTarget 上就输吗?如果是这样,您可以删除 if
语句,因为鼠标悬停事件已经添加到 blueTarget