gamekit
gamekit copied to clipboard
Error: gamekit.js:2801 Uncaught TypeError: Cannot read property 'call' of undefined
I'm working with a forked cop of your framework and with the following logic
gamekit.defineModule("main", function(){
function setup(){
gamekit.a.rejects = new gamekit.SpriteMap({
image: gamekit.a.rejects,
tileW: 400,
tileH: 400,
offsX: 0,
offsY: 0
});
var reject2 = new gamekit.Sprite(gamekit.a.rejects[2]);
gamekit.clearCanvas();
gamekit.createLayer();
gamekit.layer[0].attach(reject2);
}
var p = gamekit.loadAssets('characters.assets.json');
p.then(setup, function(){
console.log('error', arguments);
}, function(){
console.log('progress', arguments);
}).then(gamekit.start);
});
Everything loads as expected but I get an error
gamekit.js:2801 Uncaught TypeError: Cannot read property 'call' of undefined at gamekit.Sprite.update (gamekit.js:2801) at GamekitLayer.draw (gamekit.js:1224) at mainLoop (gamekit.js:263) update @ gamekit.js:2801 draw @ gamekit.js:1224 mainLoop @ gamekit.js:263
checking the line @ 2801
the this in this._update.call(this); refers to a Sprite.object
gamekit.Sprite {
false
direction
:
NaN
friction
:
0
h
:
400
life
:
NaN
originX
:
0
originY
:
0
rotation
:
0
scaleX
:
NaN
scaleY
:
NaN
speed
:
NaN
stretch
:
false
w
:
400
x
:
0
y
:
0
}
any reason why this is happening? should Sprite have an ._update function?
Are you working with the full release, or a custom build?
@Paratron i forked the repo so I'm woking with the master branch