Jump to content

Strange error caused by using destroy()


Biggerplay
 Share

Recommended Posts

I'm trying to destroy a sprite like this

gem.gem.destroy();

Where the first "gem" is an object and the 2nd is the actual sprite.

 

But when that is run in my game it's causing this error.

 

Uncaught TypeError: Cannot read property 'length' of undefined phaser.min.js:6:30774
  b.Signal.dispatch phaser.min.js:6:30774
  b.Signal.dispatch phaser.min.js:6:29120
  b.InputHandler._touchedHandler phaser.min.js:9:17906
  b.Pointer.start phaser.min.js:8:23849
  b.Mouse.onMouseDown phaser.min.js:8:18347
  b.Mouse.start._onMouseDown phaser.min.js:8:17770

 

 

I read elsewhere that there have been issues with using destroy and something to do with input handlers? but what could be causing the issue? any ideas?

Link to comment
Share on other sites

You are correct, kill() only changes some variables to "kill" the sprite out of the game and does not remove from memory but, i don't think there is enough information in the original post for me to jump to a conclusion. You can post more information (code, debug screens, better explanation of your code); you can debug deeper into phaser; or you can use groups and recycle sprites using the combo kill()/revive()

 

Sorry if that doesn't help you much but it's what i can do with what you posted and my current knowledge of Phaser.

 

Best of lucks! :D

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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