我浏览了 Playground.js 上的前两个教程 website ,但矩形并未渲染矩形。这是目录结构:
index.html scripts ---main.js ---playground.js
index.html:
<!DOCTYPE html>
<html>
<head><title>Simple Game</title></head>
<body>
<script src="scripts/main.js"></script>
<script src="scripts/playground.js"></script>
</body>
</html>
main.js:
var app = playground({
render: function() {
this.layer.clear("#000088");
this.layer.fillStyle("#ffffff");
this.layer.fillRect(32, 32, 64, 64);
}
});
playground.js是从网站下载的文件。
出了什么问题,如何解决?
最佳答案
切换您的主脚本标签和 Playground 脚本标签。顺序很重要:
<script src="scripts/playground.js"></script>
<script src="scripts/main.js"></script>
关于javascript - Playground.js 未渲染,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38445658/