级别不会在impactjs中加载

时间:2013-11-20 21:23:46

标签: javascript impactjs

我无法使用ImpactJs加载关卡。当我尝试加载到某个级别时,我在控制台中收到以下错误:

  

Uncaught无法加载资源:loader.js:91   ig.Loader.ig.Class.extend._loadCallback loader.js:91   ig.Image.ig.Class.extend.onerror

我有一个名为map1的关卡保存在我的关卡文件夹中,以下代码加载它:

    ig.module( 
    'game.main' 
)
.requires(
    'impact.game',
    'impact.font',

    'game.levels.map1'
)
.defines(function(){

MyGame = ig.Game.extend({



    init: function() {
        // Initialize your game here; bind keys etc.

        this.loadLevel( LevelMap1 );
    },

    update: function() {
        // Update all entities and backgroundMaps
        this.parent();

        // Add your own, additional update code here
    },

    draw: function() {
        // Draw all entities and backgroundMaps
        this.parent();



    }
});


// Start the Game with 60fps, a resolution of 320x240, scaled
// up by a factor of 2
ig.main( '#canvas', MyGame, 60, 960, 960, 1 );

});

谁能看到我哪里出错了?谢谢:))

1 个答案:

答案 0 :(得分:0)

尝试使用:https://github.com/phoboslab/impact-splash-loader/blob/master/impact-splash-loader.js

像这样:

.requires(
    'impact.game',
    'impact.font',
    'plugins.impact-splash-loader',
    //...
});

ig.main( '#canvas', MyGame, 60, 960, 960, 1 , ig.ImpactSplashLoader );

或许,你错过了一张图片......