Ozvooky Posted August 28, 2015 Share Posted August 28, 2015 Hi, quick question. Once the game loads, is there a way in which a sprite is automatically displayed, and then deleted after 5 seconds for example. Is this possible to implement? Link to comment Share on other sites More sharing options...
tips4design Posted August 28, 2015 Share Posted August 28, 2015 See the timer example: http://phaser.io/examples/v2/time/basic-timed-eventIn the callback function destroy your sprite. Link to comment Share on other sites More sharing options...
Ozvooky Posted August 28, 2015 Author Share Posted August 28, 2015 See the timer example: http://phaser.io/examples/v2/time/basic-timed-eventIn 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 More sharing options...
Nikow Posted August 28, 2015 Share Posted August 28, 2015 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 More sharing options...
Ozvooky Posted August 28, 2015 Author Share Posted August 28, 2015 Try this : game.time.events.add(Phaser.Timer.SECOND * 2, this.destroy, this);It worked! Thank you!! Link to comment Share on other sites More sharing options...
Recommended Posts