How to print fps to screen

I was wondering if their was a way to print the fps to the screen instead of using the show stats method or the stats extension

1 Like

sprites.create(img`.`).say(fps)? console.log(fps)? Is that what you mean?

You could probably use the (time since last frame) block in Richard’s advanced extension and a little math to get the number?

Those are the only methods I can think of. I did this though for one of my extensions:

```ts

function printFPS() {

            let now = game.runtime()

            let delta = (now - lastTime) / 1000

            if (delta > 0) {

                fps = frameCount / delta

            }

            console.log("FPS: " + Math.round(fps))

            frameCount = 0

            lastTime = now

}

That’s all though ):

oh wait now I think I know what you mean something like

right?

1 Like

Something like that. You could test it using the built in one just to make sure.