Debug Help Please

Link to the project or level: [ - Game Lab]
What I expect to happen: [I expect if touching new animation to be set.]
What actually happens: [ERROR: Line: 67: TypeError: Cannot read property ‘copy’ of nullr]

Thank you!
Student and Melodi

Hi @melodi_kunn,

When I commented out line 47, the game ran but I noticed planet_1 did not have an animation. So, then looked at line 40 and noticed the setAnimation was empty. When I chose planet_1 as the animation, the planet showed up.

I’m not sure but I think the error is generated because a collider area is set when the sprite is invisible. Anyway, when I move the collider area code (line 47) to inside the if statement on line 65, the error is removed. There is still some work to do to get the isTouching to work but these tips should get you started.

So, to get you started, choose an animation for planet_1 and move line 47 to inside the if statement on line 65.

Good luck!

1 Like

We must have looked right over that! Sorry. Thank you for the extra set of eyes!


I saw another thing that could be causing an issue. Line 43 should come before line 41. You have to declare the variable before assigning it a value.

Good luck! Looks like a fun game!