为什么我不能使用Phaser插件来减少CPU,或者代码有什么问题?
<script src="assets/js/phaser.js"></script>
<script src="assets/js/SaveCPU.js"></script>
var game = new Phaser.Game(800, 726, Phaser.AUTO, 'container',{preload: gPreload, create: create});
function create() {
this.game.plugins.add(new Phaser.Plugin.SaveCPU)
}发布于 2015-08-08 04:28:06
参见我的示例来添加Phaser插件:
var game = new Phaser.Game(1024, 768, Phaser.AUTO, '', {
init: function () {
//Load the plugin
this.game.kineticScrolling = this.game.plugins.add(Phaser.Plugin.KineticScrolling);
}
});这个例子的插件是:http://jdnichollsc.github.io/Phaser-Kinetic-Scrolling-Plugin/
发布于 2015-02-20 13:21:42
我个人不会仅仅因为github上没有文档就使用SaveCPU.js。实际上在它的GitHub库上有两个问题,所以不用费心使用这个插件了。
如果你需要减少CPU负载,你应该重构你的代码。
https://stackoverflow.com/questions/27880158
复制相似问题