0
var i:int = 0;
stage.focus=stage;
var Walls:Array = [Wall,Wall1];
addEventListener(Event.ENTER_FRAME,HitDetection);
function HitDetection(event:Event):void{
stage.addEventListener(KeyboardEvent.KEY_DOWN, myKeyDown);
function myKeyDown(e:KeyboardEvent):void
{
{
if (e.keyCode == Keyboard.LEFT)
{
if (KeemStar1.hitTestObject(Walls[i])) {
trace("1")
KeemStar1.x -=-0.1;
}
else
{
KeemStar1.x -=0.1;
}
}
if (e.keyCode == Keyboard.RIGHT)
{
{
if (KeemStar1.hitTestObject(Walls[i])) {
KeemStar1.x -=-0.1;
trace ("n")
}
else
{
KeemStar1.x +=0.1;
}
}
}
}
}
}
배열의 모든 벽 대신 첫 번째 벽과 충돌합니다. 나는 모든 것을 시도해 봤지만 나는 그것을 이해할 수 없다. 나는 actionscrip3에 익숙하지 않기 때문에 무엇을해야할지 모르겠다. 감사 !!충돌을 시도하는 중