Variable not updating

I am trying to update endGame in control.js but it is not being updated:

You’ve made endGame a global variable by putting it outside the scriptType scope

I’m not sure if this was on purpose or not. If it was, then you can set the value by doing window.endGame = false anywhere in the code base.

If it wasn’t and you wanted it in the game scripttype, then you have to move it into the correct scope:

Game.prototype.initialize = function() {
    this.endGame = false;
    this.blockTimer = 0;

And then everywhere you access the variable in the Game scripttype, you have to do with the this object

1 Like

Thank you. That helped.