Background saying "not a function" when creating a game in GameLab

(Game Lab - Code.org)
During the process of coding their games, they started getting an error message, “Background is not a function”. However, it does not happen to all students, even when using the same code. This causes their games not to run.
I have tried changing up the code for the background, refreshing the page, deleting just the background block and readding it, and rewriting the whole program. Eventually it leads to the same issue for only some students.

Any help would be appreciated.

@rlowther.om,

Are there certain conditions that make it happen? I played this game several times and didn’t get the the error message.

Mike

She is getting the message on her end. It is happening on the Conditional for the game over (If score <= 0, then display different background, etc).

@rlowther.om,

Actually, I think I found your problem. On line 10, she has renamed “background” to be a sprite. The word background is a reserved word that is already used by javascript to refer to the background block. On line 10, by renaming background to be a sprite, it causes a conflict that is most likely why the error is occurring.

Have her use a different name like bg or bckgrnd or something like that and it should solve the issue.

Mike

Thank you! I will try that.