kittykatattack / ga

The world's tiniest, cutest and funnest game engine
451 stars 85 forks source link

Alien Armada not working #48

Closed fzzylogic closed 7 years ago

fzzylogic commented 7 years ago

Hi,

I'm working through the tutorial and loving GA! The tutorial is very good, just what one needs when one is new to this. Just wanted to mention that the alienArmada demo is not working on Chrome / Firefox on Windows 10. I tried rolling back in git to when the game was first submitted, but the problem was there too. I also tried testing via the raw git link (to rule out the problem being with civetweb, the little webserver i'm using), however the problem remained.

Error returned is: plugins.js:408 Uncaught ReferenceError: sprite is not defined ga.move @ plugins.js:408 play @ 04_alienArmada.html:267 update @ ga.js:343 gameLoop @ ga.js:278

Thanks!

qsrahman commented 7 years ago

Gee! there is a bug, rather a typo in plugins.js move method :

ga.move = function(sprites) {
    if (sprites instanceof Array === false) {
      internal_move(sprites)
    } else {
      for (var i = 0; i < sprites.length; i++) {
        internal_move(sprite[i])     //<-----------(1)
      }
    }
  };

change the line (1) to:

internal_move(sprites[i])

:)

fzzylogic commented 7 years ago

Cool thanks!