Play Home Contribute Github Join Us! Discourse Staff Members Github Contribution Guides Team

Game grove - code

I got question what does this line of code means, could someone explain it to me

ui.track(db, “plays”);
ui.track(db, “defeated”);

function onVictory(event) {
db.add(“defeated”, game.defeated);

game.on(“victory”, onVictory);

how to make
ui.track(game,“time” ); time count down

please help :slight_smile:

my best geust is that is what controls the win lose code

i still don’t understand :frowning:

how to make time count down?

I don’t understand those lines of code,
please anyone explain it to me :slight_smile:

Hi @Zambi25,

ui.track(db, "defeated");
// this tracks the number of enemies you've defeated
game.on("victory", onVictory);
// this checks if victory is true, then it runs the onVictory function:

function onVictory(event) {
    db.add("defeated", game.defeated);
// this tracks how many enemies you've defeated in each game, and adds it to the total. (which can be over multiple games).

I’m not very experienced with the game editor so I’m not sure how you would get the time to count down rather than up.
If you wanted to make it go down from 60sec, the maths would be:
count = 61-(the value shown by ui.track(game, “time”)
But I’m not sure how you would show that.
@Chaboi_3000 do you know?

thx a lot @Deadpool198

but i still have one more question

what does

ui.track(db, “plays”);

and mean?

I’m not sure I’m afraid. It doesn’t really seem to do anything does it? Maybe leave it out…
It works without it.