📩Togame and Fps, Tick

sends data to game engine; engine ==> your code

Togame

togame = function(game){
if(game.paused) console.log("game paused")
if(game.resumed) console.log("game resumed")
}

Paused and resumed

Gives a warning when you enter or exit the application on win key, Pause key, or android

Fps and Tick

const fpscounter = new Text({
  "name": "fpscounter",
  "position": {
    "x": 21,
    "y": 38
  },
  "text": "Hello world!",
  "font": "Sans-serif",
  "color": "yellow",
  "size": "20px"
});


Fpscounter = (FPS,tick) => {
  fpscounter.update({text: `FPS: ${FPS} TICK: ${tick}`});
}

It shows how much fps it gets and what tick it is.

What is Fps

It tells you how many times the image is refreshed on the screen per second.

What is Tick

It is the time when the system understands that an object has moved and processes it accordingly. Things like player displacement, physics, collision can be given as examples.

Difference between Fps and Tick

Fps: time to draw to the screen per second

Tick: time per second to refresh things in the background

🔃Onload

You can change Fps and Tick in onload.js

Last updated