Create a countup timer in WoofJS

This tutorial explains how to add a countup timer in WoofJS as shown below.

image3

Use the code below to implement this in your game.

// Add a background
setBackdropURL("./docs/images/war-backdrop.png")
setBackdropStyle("cover")

// Create a variable for time starting at 0
var time = 0

// Create text variable to display time
var timertext = new Text({
  text: time, 
  size: 100
})

// Every 1 second...
every(1, "second", () => {
  // Make time go up by one
  time += 1
  // Update timer text to show new time
  timertext.text = time
})