Set FPS [b401]

BenSironko

  • Posts: 9
I'm not a really heavy coder so I'm having trouble figuring out how to set the frame rate of my project in Stencylworks. I can see via the console that it is currently running at 60 fps but I'm converting a game from Game Maker that runs at 48 fps. I'm also concerned that this might not be enough to fix the timing. According to the documentation on step size, there are 100 steps per second. In other words, I need to be able to set the project so that it updates 48 times per second if at all possible. Thanks!

« Last Edit: June 09, 2011, 08:50:06 pm by Jon »

Alexin

  • *
  • Posts: 3127
Paste the following in a code block:

setFPS(60);

The block [step size] returns the step size, in milliseconds. Both blocks are available under Flow > Advanced.
"Find the fun"
alexin@stencyl.com

BenSironko

  • Posts: 9
Does it matter where I put the code block? I've tried that at the beginning of a jump behavior I was creating but it didn't change the frame rate. Sorry for the noob questions!

BenSironko

  • Posts: 9
??? I still haven't figured out how to make my game run at 48 fps. I tried using setFPS(48); but it hasn't worked so far. I don't know if I'm putting the code block in the wrong place or what....

Alexin

  • *
  • Posts: 3127
As far as I can tell, setting the FPS does nothing (!?). I guess this is a bug.

I think the workaround is to pause and resume the game after setting the desired FPS.
And yes, you're using the block right.
"Find the fun"
alexin@stencyl.com

BenSironko

  • Posts: 9
Thanks! Hopefully the bug gets reported because I really need to code that into the game at some point!

Jon

  • *
  • Posts: 17524
Here's a patch for you. Let me know if this works. Only step (3) is required.

http://community.stencyl.com/index.php/topic,1131.0.html

« Last Edit: June 07, 2011, 08:48:41 am by Jon »

BenSironko

  • Posts: 9
Thank you so much! It works splendidly!

Broxter

  • Posts: 19
Perhaps the function to change FPS should be made into a block?
achroware.com

Joe

  • *
  • Posts: 2478
I don't think it's a common enough request to warrant a block. Users can always create a custom block for it if they want.

Jon

  • *
  • Posts: 17524
A game setting makes more sense to me.

Broxter

  • Posts: 19
A game setting makes more sense to me.
Actually, yeah.
achroware.com