Discuss Scratch

QuaticB-
Scratcher
100+ posts

How to Make an FPS Counter [TUTORIAL]


FPS Counter Tutorial

This tutorial will show you how to make an FPS (Frames Per Second) counter.
Scratch normally runs at about 30 FPS.

Step 1: Create a new sprite and name it FPS.

Step 2: Create these variables as For this sprite only in the FPS sprite, and then hide them:
(seconds since 2000)
(seconds since 2000 elapsed)
(delta)

Step 3: Create this variable as For all sprites:
(FPS)

Step 4: Create a custom block in the FPS sprite, name it update seconds since 2000 elapsed and tick the Run without screen refresh option when creating it.

Step 5: Code this under the update seconds since 2000 hat block:
define update seconds since 2000 elapsed
set [seconds since 2000 elapsed v] to ((days since 2000) / (86400))

Step 6: Code this script in the FPS sprite:
when green flag clicked
update seconds since 2000 elapsed :: custom
forever
set [seconds since 2000 v] to ((days since 2000) / (86400))
set [delta v] to ((seconds since 2000 elapsed) - (seconds since 2000))
set [FPS v] to ((1) / (delta))
update seconds since 2000 elapsed :: custom
end

  • Now, the variable
     (FPS) 
    will start displaying the FPS.

Last edited by QuaticB- (Nov. 29, 2024 08:40:30)

ametrine_
Scratcher
1000+ posts

How to Make an FPS Counter [TUTORIAL]

Help with Scripts is for getting help with scripts, not making guides on scripts. please put this in a project instead
QuaticB-
Scratcher
100+ posts

How to Make an FPS Counter [TUTORIAL]

ametrine_ wrote:

Help with Scripts is for getting help with scripts, not making guides on scripts. please put this in a project instead
oh lol i didnt know.
So there's no place in the forums where I can put this?
kurama_link_12
Scratcher
3 posts

How to Make an FPS Counter [TUTORIAL]

ametrine_
Scratcher
1000+ posts

How to Make an FPS Counter [TUTORIAL]

kurama_link_12 wrote:


please stay on-topic
LJayDaGoat
Scratcher
32 posts

How to Make an FPS Counter [TUTORIAL]

QuaticB- wrote:

FPS Counter Tutorial

This tutorial will show you how to make an FPS (Frames Per Second) counter.
Scratch normally runs at about 30 FPS.

Step 1: Create a new sprite and name it FPS.

Step 2: Create these variables as For this sprite only in the FPS sprite, and then hide them:
(seconds since 2000)
(seconds since 2000 elapsed)
(delta)

Step 3: Create this variable as For all sprites:
(FPS)

Step 4: Create a custom block in the FPS sprite, name it update seconds since 2000 elapsed and tick the Run without screen refresh option when creating it.

Step 5: Code this under the update seconds since 2000 hat block:
define update seconds since 2000 elapsed
set [seconds since 2000 elapsed v] to ((days since 2000) / (86400))

Step 6: Code this script in the FPS sprite:
when green flag clicked
update seconds since 2000 elapsed :: custom
forever
set [seconds since 2000 v] to ((days since 2000) / (86400))
set [delta v] to ((seconds since 2000 elapsed) - (seconds since 2000))
set [FPS v] to ((1) / (delta))
update seconds since 2000 elapsed :: custom
end

  • Now, the variable
     (FPS) 
    will start displaying the FPS.
it gave back negative numbers i think i forgot something
Paddle2See
Scratch Team
1000+ posts

How to Make an FPS Counter [TUTORIAL]

Hello! It's great that you want to help out other Scratchers. However, I think we have enough guides in the forums at the moment. Please feel free to welcome new Scratchers on the group welcoming topic or on individual topics created by New Scratchers.

Other places that can always use more helpful Scratchers like you, are the "Help With Scripts“ and ”Questions About Scratch" areas - please use them as designed, by responding to topics created by folks with problems to solve

Finally, a really good place for Scratch guides is the Scratch Wiki - check it out and see if it's something you might like to work on. They have a number of guides - and great organization.

Powered by DjangoBB