我想用 Javascript 创建一个 DOS 风格的游戏,但我无法正确显示地图。
这是 Windows 控制台中的数组:
char Map[1][10][20] = {
"####################",
"# #",
"# #",
"# #",
"# #",
"# #",
"# #",
"# #",
"# #",
"####################",
};
这就是我的javascript代码
var Map = {
"#":["#","#","#","#","#","#","#","#","#","#","#","#","#","#"],
"#":["#"," "," "," "," "," "," "," "," "," "," "," "," ","#"],
"#":["#"," "," "," "," "," "," "," "," "," "," "," "," ","#"],
"#":["#"," "," "," "," "," "," "," "," "," "," "," "," ","#"],
"#":["#"," "," "," "," "," "," "," "," "," "," "," "," ","#"],
"#":["#"," "," "," "," "," "," "," "," "," "," "," "," ","#"],
"#":["#"," "," "," "," "," "," "," "," "," "," "," "," ","#"],
"#":["#"," "," "," "," "," "," "," "," "," "," "," "," ","#"],
"#":["#"," "," "," "," "," "," "," "," "," "," "," "," ","#"],
"#":["#","#","#","#","#","#","#","#","#","#","#","#","#","#"]
};
本质上,我希望它完全按照它的出现输出第一个数组。我应该能够做其他所有事情。