Debug help CSD Lesson 18

We think the problem with code is starting on line 114

What should happen:

When you click inside the fireplace 2 times, the fire1, 2, 3 variable should choose a random number. When the number is == 16 the fire sprites should become visible.

What is happening:

fire1 and fire2 sprites are not becoming visible. Student debugged by setting all variables to 16. Only fire.visible == true would work. When he put in a watcher, fire1.visible it just said undefined.

As I’m writing this I’m wondering if a variable can have the same label as a sprite (see line 115 and line 123).

Also, he cannot go back into blocks. It says there is an error, but he’s not getting an error message with a line to check.

Greetings @lorikaye,


I believe the problem is the fact that you cannot have the same name for 2 different variables (as you mentioned in your post already).
It will simply think it’s the same single variable, so I suggest you give them different names.

The issue with it not turning into blocks is because of an extraneous semicolon here.

image


Sincerely, @pluto