Giter Site home page Giter Site logo

gamekit's Issues

Write unit tests

Hey @Paratron, I'm writing some unit tests on Jasmine and getting it to work with Grunt. In one day or two, I'll make a pull request including them :)

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?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.