I'm developing a game in JavaScript & HTML5 with CreateJS. (I doubt you'll need CreateJS experience to answer this question, though)

My main game loop function is initialized and run using the CreateJS library like so:

createjs.Ticker.on("tick", loop);

(Similar to an event handler)

Then, it's off to the races - my function loops indefinitely, running my game at around 50FPS.

I want to cap this at 30FPS. But without a "sleep" function, or any real "pause" function, what's the best way to do that? How can I force my loop to slow down?

Thanks! -W


From the documentation:

Ticker.framerate = 30;

Hope that helps.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.