请帮助..我无法弄清楚是什么造成错误:
未捕获的TypeError:对象
function (selector,scope,options) { return Q.select(selector,scope,options); }
没有方法'动画'
我的代码:
var Q = Quintus()
.include('Sprites', 'Anim')
.setup({width: 800, height: 480});
Q.Sprite.extend('Player', {
init: function(p){
this._super(p, {
sprite: 'player',
sheet: 'player',
x: Q.el.width/2,
y: Q.el.height-60,
type: Q.SPRITE_FRIENDLY,
speed: 10
});
this.add('animation');
this.play('default');
}
});
Q.load(['spacebackground.png','spaceship2.png','player.json'], function(){
Q.compileSheets('spaceship2.png', 'player.json');
Q.animations('player', {default: {frames: [0,1,2,3], rate: 1/4}});
var bg = new Q.Sprite({asset: 'spacebackground.png', x: Q.el.width/2,
y: Q.el.height/2, type: Q.SPRITE_NONE});
var player = new Q.Player();
Q.gameLoop(function(dt){
Q.clear();
bg.render(Q.ctx);
player.update(dt);
player.render(Q.ctx);
});
});
答案 0 :(得分:0)
我敢打赌50%的人都犯了这个错误,Quintus有时候会有一些非语法,请查看这一行:
.include('Sprites', 'Anim')
它应该是1个参数字符串:
.include('Sprites, Anim')
我的错误是我把模块列表放在了数组中!我多么愚蠢!