Line 6: ReferenceError: x is not defined


Hi, again. Making a maze game. The code I used for the cursor is:

function update (){
this.x = mouseX
this.y = mouse

if(this.hitTest(wall.png)) {
if(this.hitTest(wall2.png)) {
if(this.hitTest(wall3.png)) {
if(this.hitTest(i.png)) {

Somehow got this line 6: ReferenceError: wall.png is not defined.
Help please.


Where did you define wall.png? Is there an object in the scene with that name?


Yes. Since that error, I modified the project.


So how’s it going? Need any more help?


Hi there!

I seem to have missed this post - sorry about that! Please let me know if you need any other help.


Yup. How do I stop this error?


Javascript probably doesn’t like the name “wall.png”. It implies there is an object called “wall” which contains something called “png”.

Try naming the image something else, and use that name in your code!


Thanks. Also converted images to movie clips at that time.


I got rid of png and it will not want to listen