This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2009-08-16 13:49:28

illusionist
Retired Community Moderator
Registered: 2008-07-02
Posts: 1000+

How can a FPS counter be made?

I've been searching the forums and I can't find anything! I just need a way to measure lag. A FPS block would be great! http://img35.imageshack.us/img35/784/fps.gif But there are probably already ways to do things like that. Any help is welcome.

Is there a way to make a frame counter using the[blocks] <timer> [/blocks] block and variables?


http://i.imgur.com/8LX1NrV.png

Offline

 

#2 2009-08-16 14:58:32

demosthenes
Retired Community Moderator
Registered: 2008-02-19
Posts: 1000+

Re: How can a FPS counter be made?

That would be helpful. I think you can do something similar by doing this:
[blocks]
<reset timer>
<set{ counter }to( 0 )
<repeat until> <( <timer> <>> 10 )>
<change{ counter }by( 1 )
<end>
<set{ fps }to( (( <{ counter }> </> 10 ))
[/blocks]

OR

[blocks]
<reset timer>
<set{ counter }to( 0 )
<forever>
<change{ counter }by( 1 )
<set{ fps }to( (( <{ counter }> </> <timer> ))
[/blocks]

Last edited by demosthenes (2009-08-16 15:00:27)


I've taken a long hiatus, but I still visit sometimes. Give me some time to answer any messages you post on my projects!

Offline

 

#3 2009-08-16 15:33:05

illusionist
Retired Community Moderator
Registered: 2008-07-02
Posts: 1000+

Re: How can a FPS counter be made?

demosthenes wrote:

That would be helpful. I think you can do something similar by doing this:
[blocks]
<reset timer>
<set{ counter }to( 0 )
<repeat until> <( <timer> <>> 10 )>
<change{ counter }by( 1 )
<end>
<set{ fps }to( (( <{ counter }> </> 10 ))
[/blocks]

OR

[blocks]
<reset timer>
<set{ counter }to( 0 )
<forever>
<change{ counter }by( 1 )
<set{ fps }to( (( <{ counter }> </> <timer> ))
[/blocks]

I'll compare it to bubble07's method.

EDIT: It worked! Thanks man!

Last edited by illusionist (2009-08-16 15:37:20)


http://i.imgur.com/8LX1NrV.png

Offline

 

Board footer