我正在使用actionscript 3开发Flash游戏。它就像迷宫游戏一样。我们有一条船和绳索创建路径。我遇到了碰撞问题。在通过该路径时,它正确地碰撞到X轴& Y轴上,并且其工作正常,但是当它在任何角落(其中X轴与Y轴相遇)碰撞时,它只是穿过绳索。 这是我的碰撞脚本。ActionScript 3碰撞
if (leftArrow)
{
boat.x -= speed;
if(rope.hitTestPoint(boat.x,boat.y,true)){
boat.x += 5;
}
if(rope.hitTestPoint(boat.x,boat.y+height,true)){
boat.x += 5;
}
}
else if (rightArrow)
{
boat.x += speed;
if(rope.hitTestPoint(boat.x+boat.width,boat.y,true)){
boat.x -= 5;
}
if(rope.hitTestPoint(boat.x+boat.width,boat.y+height,true)){
boat.x -= 5;
}
}
else if (upArrow)
{
boat.y -= speed;
if(rope.hitTestPoint(boat.x,boat.y,true)){
boat.y += 5;
}
if(rope.hitTestPoint(boat.x+boat.width,boat.y,true)){
boat.y += 5;
}
}
else if (downArrow)
{
boat.y += speed;
if(rope.hitTestPoint(boat.x,boat.y+boat.height,true)){
boat.y -= 5;
}
if(rope.hitTestPoint(boat.x+boat.width,boat.y+boat.height,true)){
boat.y -= 5;
}
}