farzher Posted May 1, 2014 Share Posted May 1, 2014 My game is exploitable when played at low framerate, because everything slows down, except the timers. Can I use a timer that's based on frames, not ms? Or am I expected to just code that myself? You have a nice timer class, it'd be great if I could use it. Link to comment Share on other sites More sharing options...
rich Posted May 1, 2014 Share Posted May 1, 2014 There are no plans to add this. It would be easy enough to adapt the current Timer class code to do what you need, but it isn't something we'll be doing here. Link to comment Share on other sites More sharing options...
farzher Posted May 1, 2014 Author Share Posted May 1, 2014 Instead of messing with your timer class, I think it'd be easier to make my own frametimer object.Is there an empty gameobject class I can extend? I didn't see one, the only way I know how to do this is using a sprite:I want to make an empty game object, give it an amount of frames and a callback, it'll add itself to the game so update gets called on it, then it'll call the callback and destroy itself when it's done. Link to comment Share on other sites More sharing options...
farzher Posted May 3, 2014 Author Share Posted May 3, 2014 How do I fix the performance of this? This is pretty bad haha.I'm adding an image to the game to get update called on it. Idk how else to know when frames a frame passes.# TODO: performance is badclass FrameTimer extends Phaser.Image (@duration, @callback, @context) -> super game @frameCount = 0 game.add.existing @ update: -> @frameCount += 1 if @frameCount > @duration @callback.call @context @destroy!It's used like this, and works well:new FrameTimer @reloadSpeed, (-> @canShoot = true), @ Link to comment Share on other sites More sharing options...
Recommended Posts