charlie_says Posted May 14, 2014 Report Share Posted May 14, 2014 I'm trying to make a one off delayed event, so ideally something like setTimeout, which fires once (and, if necessary, then removes itself.) But I'm not getting anywhere very fast with this - anyone tried something similar? Quote Link to comment Share on other sites More sharing options...
stasuss Posted May 14, 2014 Report Share Posted May 14, 2014 Something like this?http://examples.phaser.io/_site/view_full.html?d=time&f=basic+timed+event.js&t=basic%20timed%20event Quote Link to comment Share on other sites More sharing options...
charlie_says Posted May 14, 2014 Author Report Share Posted May 14, 2014 Ok, I'm trying this now... (I was trying Phaser.Timer) does this automatically remove itself after it's fired? Quote Link to comment Share on other sites More sharing options...
stasuss Posted May 14, 2014 Report Share Posted May 14, 2014 I think so, but to be sure I'll do this:game.time.events.add(Phaser.Timer.SECOND * 4, fadePicture, this).autoDestroy = true; charlie_says 1 Quote Link to comment Share on other sites More sharing options...
hayesmaker Posted April 22, 2015 Report Share Posted April 22, 2015 how would you cancel that? Quote Link to comment Share on other sites More sharing options...
rsadwick Posted April 23, 2015 Report Share Posted April 23, 2015 how would you cancel that? var timer = game.time.events.add(Phaser.Timer.SECOND * 4, fadePicture, this);//at some point you want to remove itgame.time.events.remove(timer); MichaelD 1 Quote Link to comment Share on other sites More sharing options...
valueerror Posted April 23, 2015 Report Share Posted April 23, 2015 is autodestroy really neccesary ? what happens if you don't add this? (just asking because i nevery add autodestroy.. i thought they destroy themselves anyway ?! Quote Link to comment Share on other sites More sharing options...
MichaelD Posted April 23, 2015 Report Share Posted April 23, 2015 So we can all agree we want suicidal timers? (I'm sorry I just had to say it...) Quote Link to comment Share on other sites More sharing options...
drhayes Posted April 23, 2015 Report Share Posted April 23, 2015 Hey, what you get back from "game.time.events.add" isn't a Timer, it's a TimerEvent. They don't have an autoDestroy property, they're already single-use. jdnichollsc 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.