0

I am currently making an incremental game and I am making achievements. When the earn function tries to set the value of the awarded list in the achievement object from false to true, I get this error:

Cannot set properties of undefined (setting '1')

The awarded list is clearly defined as I mentioned before, so why does it say undefined?

An addon error is when I click the object that gives score, the score stays at 0, and there is no error when I click.

here is code if it helps:

awarded: [false, false],
    earn: function(index) {
        this.awarded[index] = true; //the error comes from this line
        display.updateAchievements();
    }

please tell me if you need to see any more code.

0 Answers0