In the level I am currently working on (Shine Getter in the Desert world), the goal is to only collect gold coins so that you can get more gold more quickly. The goal of this level is to aid in my understanding of arrays, so I need to use them. Here's what I have:
Basically, how it should function is that repeatedly, the hero finds an array of items (given the only item type is a coin), and cycles through each one: if it has a coin value of 3, then the hero should move to the coin. However, the program is telling me that I “cannot read property ‘value’ of undefined”. What does this mean? How can I fix it? Another thing – The “if coin value == 3” script was put in automatically. So why is it reading it like it’s an error? If anyone could help, I’d be grateful.