试着保持这个简短.使用phpstorm查看我的代码并得到一些错误.
它说我的函数命名位置有一个"隐式声明的变量"
function towngate10() {
updateDisplay(locations[10].description);
if (!gate10) {
score = score+5;
gate10 = true;
}
playerLocation = 10;
displayScore();
document.getElementById("goNorth").disabled=true;
document.getElementById("goSouth").disabled=false;
document.getElementById("goEast").disabled=true;
document.getElementById("goWest").disabled=true;
}
Run Code Online (Sandbox Code Playgroud)
另外,我只是想确保我正确地研究了我的原型只是一个样本
全局数组:
var locations = [10];
locations[0] = new Location(0,"Intersection","This is where you awoke.");
locations[1] = new Location(1,"Cornfield","The cornfields expand for miles.");
locations[2] = new Location(2,"Lake","A large lake that is formed by a river flowing from the East.", new Item(1,"Fish","An old rotting fish."));
locations[3] = new Location(3,"Outside Cave","Entrance to the dark cave.");
Run Code Online (Sandbox Code Playgroud)
位置功能:
function Location(id, …Run Code Online (Sandbox Code Playgroud)