不知道怎么回事 这个函数应该为数组中的每个名字放一个新玩家
function newplayer() {
var y = data.playerY;
var x = data.playerX;
var player ="";
var players={name1:"Jao",name2:"lucas",name3:"pedro",name4:"jorge"};
for(var p in players)
{
player = players[p];
var xpos = (x-y)*tileH + mapX;
var ypos = (x+y)*tileH/2+ mapY;
ctx.drawImage(charImg[0],xpos,ypos-(charImg[0].height/2));
//ctx.fillText(player.name, xpos + 10, ypos - (charImg[0].height/2) - 5);
}
}
编辑:设法改变代码 var player = player [p], for player = player [p];
obrigado vocês que me ajudarão inclusive Igor
对不起我的英语我来自巴西