Jump to content

SpriteBatch undefined


arcbox
 Share

Recommended Posts

Hey everyone,

 

I'm trying to use SpriteBatch for optimization, and I'm initializing it like this:

 

spriteBatch = new Phaser.SpriteBatch(game, this);

 

But I get the following error on that line:

 

"Uncaught TypeError: undefined is not a function"

 

Am I initializing the spritebatch incorrectly? I would like to avoid game.add if possible.

 

Thanks!

 

 

Link to comment
Share on other sites

Why do you not want to use game.add? (or game.make), it handles the references properly for you.

 

But anyway I would guess the problem is that 'this' (in your SpriteBatch constructor) isn't of the required type. What does it equal? It needs to be a Group, or a DisplayObjectContainer at the least. Failing that post the actual line number the error occurs on (assuming its raised within phaser.js and not your own game :))

Link to comment
Share on other sites

  • 2 months later...
  • 2 years later...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...