Jump to content

Destroy a sprite after x seconds


Ozvooky
 Share

Recommended Posts

See the timer example: http://phaser.io/examples/v2/time/basic-timed-event

In the callback function destroy your sprite.

Ok ill check it out. Thank you!

 

Edit:

 

I tried it but it didn't work, here is the code. Any ideas on why it didnt work? Thanks!

 

create: function() {
game.time.events.add(Phaser.Timer.SECOND * 2, destroy, this);
},
 
destroy: function() {
splash.destroy();
},
Link to comment
Share on other sites

 

Ok ill check it out. Thank you!

 

Edit:

 

I tried it but it didn't work, here is the code. Any ideas on why it didnt work? Thanks!

 

create: function() {
game.time.events.add(Phaser.Timer.SECOND * 2, destroy, this);
},
 
destroy: function() {
splash.destroy();
},

 

 

Try this :

 

game.time.events.add(Phaser.Timer.SECOND * 2, this.destroy, this);

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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