Game Dev Project - Functions and Scope - Mole unearther

Link for the project - https://www.codecademy.com/paths/create-video-games-with-phaser/tracks/game-dev-learn-javascript-function-and-scope/modules/game-dev-project-functions-and-scope/projects/mole-unearther

Hi there,
I’m stuck on step 5 for this project. I’ve set up the variables as per instructions. However, after I saved my code and ran the program, I can’t see the timeleft and score board on the top left corner. It just appears with a salmon pink background with J, K, L and a pale orange rectangle box on the top left corner. Is there something to do with my chrome setting?

The first 3 lines are the codes I added, and the rest of the codes are unedited from the project.

1 const timeLeft = 30;
2 const score = 0;
3 const isPaused = false;
4 // Stores the current “key” location of the mole
5 let currentBurrowKey;
6
7 const gameState = {};
8
9 class GameScene extends Phaser.Scene {

Much appreciated if anyone could give me some directions…

Many thanks in advance!

2 Likes

Hey @cssace70814!

Should these variables be constant if you’re gonna change 'em?

1 Like

Thanks Steven for the reply. Still doesn’t work after I changed variables to constant.
I copied and pasted the solution code still doesn’t work. I know I’m not suppose to do that (cheating!) but I just want to check if my coding logic is wrong or there’s something to do with the setting on my chrome. Turns out that it’s the later. It would be great if you or anyone else have any ideas on what I should do next??

Hmm, I would recommend trying it in a different browser (such as firefox) so you can make sure that it isn’t just a problem for that browser.

Can you send a screenshot as well of your unexpected result?

Interestingly, the game won’t run on my Chrome and IE browsers

Here is the screenshot

It’ll run on firefox, but the time and score board still not showing up on the top left corner.
Here is the solution code
Solution code for mole unearther

Check your learning environment… Does it have all these files?

You can access it by clicking the folder icon next to the file name.

Thanks Steven. Yes, all files are there. Still doesn’t work on Chrome. To be honest, I’ve given up. I’ll use Firefox from now on for Codecademy gaming projects. Thanks a lot for all the suggestions you’ve given me!

1 Like

Hey,

I’m having the same problems for this exercise. I tried copy/pasting the solution code and comparing that with the code from the working version, and it still doesn’t run like the working version. These Phaser Projects are new and I’m guessing that CC will be on it soon.

Hello,

I am getting this same issue in both firefox and chrome. Also Codecademy does not work on internet explorer. I am not sure how I am supposed to fix this issue. Any ideas?

Do you have the latest version of all the web browsers?

Yep. I have no current updates for chrome and firefox was just installed on my computer. The weirdest part is that if I restart the project the game pulls up the burrows no problem but the second I put in the first variable it gives that pink background.

I got it figured out there was an issue with one of my variables. Man learning how to code and keeping track of every character is a challenge :rofl: :sweat_smile:

1 Like

It happened the same to me and I use let to declare de variables. Im using safari.

Did it display the information of timeLeft on firefox?