我这里有一段代码,一旦到达对象并按下向下键,就可以在不同级别的第1帧和第2帧之间切换。但它不起作用。。。完全我一直收到错误1010,一个术语是未定义的,没有属性(然后是位置),但我在问题所在的地方根本看不到任何问题。
} else if(e.keyCode == Keyboard.DOWN){
downPressed = true;
if(player.hitTestObject(back.Other.lockedDoor)){
//proceed to the next level if the player is touching an open door
gotoLevel2();
}
}
}
function gotoLevel2():void{
back.Other.gotoAndStop(2); //updates door and key
back.Visuals.gotoAndStop(2); //updates the visuals
back.Visuals_2.gotoAndStop(2);
back.Collisions.gotoAndStop(2); //updates the collisions
scrollX = 0; //resets the player's x position in the new level
scrollY = 500; //resets the player's y position in the new level
}
ANy修复/建议?这个项目的最后期限正在慢慢临近,我开始担心了!
提前欢呼
如果有人觉得自己很善良,我可以把文件发出去。Teehee!
查看if(player.hitTestObject(back.Other.lockedDoor)){
Other
没有定义,所以只需将其替换为if(player.hitTestObject(back.lockedDoor)){
(对于其他阅读本文的用户,他给我发了fla
)
也正因为如此,请从gotoLevel2
函数中删除back.Other.gotoAndStop(2);
。此外,未定义Visuals
、Visuals2
和Collisions
。修复或删除代码的该部分。
PS
我通过电子邮件向您发送了固定的fla