How to add an countdown timer in a game for ech round

ok so i wanna know can i get a timer in game that times each round say like 5:00 minutes and when they time ends the timer restarts

ok so I need to know how add an timer into the game and stops whenn the round stops then goe to the next round.
heres an link to the project:https://playcanvas.com/editor/scene/708184

In any script, you can use the dt variable passed to the update function to increment a timer. For example:

var Timer = pc.createScript('timer');

// initialize code called once per entity
Timer.prototype.initialize = function() {
    this.timer = 0;
};

// update code called every frame
Timer.prototype.update = function(dt) {
    this.timer += dt;

    if (this.timer > 10) {
        // 10 seconds has elapsed - do whatever you need here...

        // Reset the timer
        this.timer = 0;
    }    
};
2 Likes

wow um thnx im really new to coidng but im learning in freecodecamp.com

but how do i get the timer to actually start or do something