Discuss Scratch

ScratchCatHELLO
Scratcher
1000+ posts

FPS Counter

How do you create a frames-per-second counter?
CashyTheCoin
Scratcher
49 posts

FPS Counter

To create a frames-per-second counter, you can simply use the code in the project found in the sprite named “FPS Counter”.
https://scratch.mit.edu/projects/404468437/
ScratchCatHELLO
Scratcher
1000+ posts

FPS Counter

CashyTheCoin wrote:

To create a frames-per-second counter, you can simply use the code in the project found in the sprite named “FPS Counter”.
https://scratch.mit.edu/projects/404468437/

I'm not sure it's working. It keeps reporting 31 fps, and my game is clearly not running at 31 fps. Are you sure it doesn't require any extra setup?

(Also, I though scratch was capped at 30fps)
shrederss
Scratcher
7 posts

FPS Counter

ScratchCatHELLO wrote:

CashyTheCoin wrote:

To create a frames-per-second counter, you can simply use the code in the project found in the sprite named “FPS Counter”.
https://scratch.mit.edu/projects/404468437/

I'm not sure it's working. It keeps reporting 31 fps, and my game is clearly not running at 31 fps. Are you sure it doesn't require any extra setup?

(Also, I though scratch was capped at 30fps)


Yeah scratch can only run at 30fps, there is a software that can run scratch at 60 or 75 fps, and trust me its too fast.
DerpyHead0
Scratcher
1000+ posts

FPS Counter

this is an old topic, but since it's already been bumped and it was never answered, i guess i should answer.
setfpsto0setlastFrameTimeto0foreveriffps=Infinitythensetfpsto1/timer-lastFrameTimeelsesetfpstoroundfps+1/timer-lastFrameTime/2setlastFrameTimetotimer. . .
it does often show 31, but that's likely accurate as scratch's frame cap isn't exact
Just_ng
Scratcher
500+ posts

FPS Counter

DerpyHead0 wrote:

this is an old topic, but since it's already been bumped and it was never answered, i guess i should answer.
setfpsto0setlastFrameTimeto0foreveriffps=Infinitythensetfpsto1/timer-lastFrameTimeelsesetfpstoroundfps+1/timer-lastFrameTime/2setlastFrameTimetotimer. . .
it does often show 31, but that's likely accurate as scratch's frame cap isn't exact
Thanks, this helped a lot!
SimpleExeProductions
Scratcher
11 posts

FPS Counter

Mine is in decimals, how can I fix?
SimpleExeProductions
Scratcher
11 posts

FPS Counter

DerpyHead0 wrote:

this is an old topic, but since it's already been bumped and it was never answered, i guess i should answer.
setfpsto0setlastFrameTimeto0foreveriffps=Infinitythensetfpsto1/timer-lastFrameTimeelsesetfpstoroundfps+1/timer-lastFrameTime/2setlastFrameTimetotimer. . .
it does often show 31, but that's likely accurate as scratch's frame cap isn't exact


Mine is in decimals, how can I fix?

ScratchCatHELLO
Scratcher
1000+ posts

FPS Counter

SimpleExeProductions wrote:

Mine is in decimals, how can I fix?

you don’t need to, but if you want to:

roundFPS
Owen_the_coder1234
Scratcher
5 posts

FPS Counter

SimpleExeProductions wrote:

DerpyHead0 wrote:

this is an old topic, but since it's already been bumped and it was never answered, i guess i should answer.
setfpsto0setlastFrameTimeto0foreveriffps=Infinitythensetfpsto1/timer-lastFrameTimeelsesetfpstoroundfps+1/timer-lastFrameTime/2setlastFrameTimetotimer. . .
it does often show 31, but that's likely accurate as scratch's frame cap isn't exact


Mine is in decimals, how can I fix?

just use
roundFPS

Powered by DjangoBB