Discuss Scratch

danboy12342
Scratcher
24 posts

How do i make a FPS counter?!?!?!

HI,
i need some help.
i need a fps counter but cant quite make one?
gor-dee
Scratcher
1000+ posts

How do i make a FPS counter?!?!?!

put this in your main game loop
setFPStoround1/timerresettimer
danboy12342
Scratcher
24 posts

How do i make a FPS counter?!?!?!

thanks
codeman1044
Scratcher
1000+ posts

How do i make a FPS counter?!?!?!

There's another way to do this that I prefer, as it doesn't mess with the timer. It does take a couple more blocks, but it works fine.
There's going to be a couple of variables: fps (don't show this one) and FPS (the one that you will show)
whenclickedforeverchangefpsby1whenclickedforeverwait1secssetFPStofpssetfpsto0
Explanation: FPS stands for frames per second. It takes one frame for a forever loop to run once. Therefore, in one second, you can run a forever loop X amount of times based on your FPS. If you keep changing a value by one each frame, that value will reach your fps each second.

Last edited by codeman1044 (May 20, 2019 12:26:42)

deck26
Scratcher
1000+ posts

How do i make a FPS counter?!?!?!

codeman1044 wrote:

There's another way to do this that I prefer, as it doesn't mess with the timer. It does take a couple more blocks, but it works fine.
There's going to be a couple of variables: fps (don't show this one) and FPS (the one that you will show)
whenclickedforeverchangefpsby1whenclickedforeverwait1secssetFPStofpssetfpsto0
Presumably less reliable as the project slows down. The wait block is less accurate than the timer.
codeman1044
Scratcher
1000+ posts

How do i make a FPS counter?!?!?!

I guess… it's just that I prefer it. The fps might be off by one or two frames if it slows down, but I've tested this and it works fine at 20+ fps (never have seen it go lower).
I use a lot of projects that rely on the timer. Just put that code up in case anyone else had the same case.
gor-dee
Scratcher
1000+ posts

How do i make a FPS counter?!?!?!

I guess you could do
set FPStoround1/timer-oldTimesetoldTimetotimer
if the timer was used elsewhere (unless it's being reset all the time)
LifeTecLoverYT
Scratcher
33 posts

How do i make a FPS counter?!?!?!

does turbo mode mess up the fps counter?
LifeTecLoverYT
Scratcher
33 posts

How do i make a FPS counter?!?!?!

another fps counter example
whenclickedforeverchangecounterby1wait0secsiftimer>1thenresettimersetFPStocountersetcounterto0

Last edited by LifeTecLoverYT (April 24, 2020 10:11:09)

potatomanABC
Scratcher
14 posts

How do i make a FPS counter?!?!?!

LifeTecLoverYT wrote:

another fps counter example
whenclickedforeverchangecounterby1wait0secsiftimer>1thenresettimersetFPStocountersetcounterto0
bruh that was from FUNUT/Professor Blue…
Lightthefox
Scratcher
13 posts

How do i make a FPS counter?!?!?!

You can do:
whenclickedforeverchangecntby1wait0secsifownTime>1thensetownTimeto0setFPStocntsetcntto0whenclickedforeverchangeownTimeby0.1wait0.09secs
i hope its correct

Last edited by Lightthefox (April 13, 2021 09:58:41)

Ankit_Anmol
Scratcher
500+ posts

How do i make a FPS counter?!?!?!

gor-dee wrote:

put this in your main game loop
setFPStoround1/timerresettimer
This is GENIUS! thanks for showing me this!!!!
Proforce101
Scratcher
100+ posts

How do i make a FPS counter?!?!?!

Ankit_Anmol wrote:

gor-dee wrote:

put this in your main game loop
setFPStoround1/timerresettimer
This is GENIUS! thanks for showing me this!!!!
I LIKE DOGE
ThinkAlt_DJ
Scratcher
1 post

How do i make a FPS counter?!?!?!

Thanks for using the fps

gor-dee wrote:

put this in your main game loop
setFPStoround1/timerresettimer
if I press to stop, it will change the text that says “infinite” the block is so
helloworldbyeworld
Scratcher
1000+ posts

How do i make a FPS counter?!?!?!

ThinkAlt_DJ wrote:

Thanks for using the fps

gor-dee wrote:

put this in your main game loop
setFPStoround1/timerresettimer
if I press to stop, it will change the text that says “infinite” the block is so
This is the simplest FPS counter that doesn’t have this bug that I can think of:

whenclickedforeverresettimersetFPSto1/timerwait1/30secs max 30 FPSwhentimer>0.3setFPSto-Ifyouhaveathumbnail,showthethumbnailhere
PopzearX
Scratcher
26 posts

How do i make a FPS counter?!?!?!

Make variables:
Create a Variable named “Frame” and create another one named “FPS” and then hide Frame!

a real fps counter script:
whenclickedforeverchangeFrameby1whenclickedforeverwait1secsifFrame>31thensetFPSto31elsesetFPStoFrame

i hope that helped a lot!


also here is the fps counter project: FPS COUNTER

Last edited by PopzearX (July 18, 2024 06:01:37)

Powered by DjangoBB