Mole Unearther Step 8

Hi Everyone!

I’m having trouble with the following project - Mole Unearther

It is called Mole Unearther, in the Learn Javascript Functions and Scope module.

I am currently on Step 8, where I should be calling a previously added function to show a countdown timer. When I run the code I should see the timer counting down, but I don’t see a countdown or even a timer section.

The game screen has a white box in the top left corner where the timer should be, but I only see the Score, with no timer.

Step 2 indicates -
At the top of our GameScene.js file, let’s create a timeLeft variable and set it to 30 , which is the number of seconds we will allot for gameplay. It will be used to track how many seconds are left as the game progresses.

Step 3 indicates -
Next, the user will want to know how many points they have. Initialize a score variable and start the user off with 0 points.

I have added completed both steps by adding the code to the top of the file, like so -

let timeLeft = 30;

let score = 0;

Step 8 indicates to call a newly created function within another function to enable the countdown timer. I have added that code like so -

create() {
const updateTimer = () => {
** timeLeft -= 1;**
}
// executed after every second passes
const onSecondElapsed = () => {
if (isPaused === false) {
updateTimer();
// display the new time to the user
this.updateTimerText();
}
};

Again with these added, I can see ‘Score’ but not ‘Timer’, and I see no running timer once I complete Step 8.

I assumed I was moving as required through the project but now that Step 8 calls for something that doesn’t seem to be happening, I’m unsure what I am missing or if there is perhaps even something wrong with the project/file?

Any help would be greatly appreciated! This is also my first time posting, so apologies if this is in the wrong forum or missing any needed info.

Thanks again!

When you ask a question, don’t forget to include a link to the exercise or project you’re dealing with!

If you want to have the best chances of getting a useful answer quickly, make sure you follow our guidelines about how to ask a good question. That way you’ll be helping everyone – helping people to answer your question and helping others who are stuck to find the question and answer! :slight_smile:

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.