Cursed WonderGlade


#1

I’m not sure if it’s bug in level or I did something wrong in code because when i press start hero doing everything fine and level is accomplished but in code lines i got pop out that there it TypeError: Cannot read property ‘type’ of null while i defined it.


#2

At the time of execution
Parts of cycles
The item does not exist
Accordingly, the type of non-existent item can not be read

Add a check for the existence of item


#3

So I have to add variable for item after else to be read yes?


#4

Use “and” logical operator
At the line 12

if item exist AND if type of item not gem


#5

In early levels (Wonderglade for example) you’ve met the concept how to check the existence of items/enemies.

var item = hero.findNearestItem();
if (item) {
    // item here
...

Have you solved levels before or jumped at this level by direct URL?


#6

I solved level with and without fixing this problem, anyway thanks you all for help.
But i think game gets sometimes too easy when you got bit too good equipment and you can just with simple code lanes solve it when game wants you to think and make it more complicated to use all you have learned :confused:

Ps. Never thought about skiping levels by direct url.