This site requires JavaScript, please enable it in your browser!
Greenfoot back
wlau1010
wlau1010 wrote ...

2016/11/15

Error with context

wlau1010 wlau1010

2016/11/15

#
To start off with i'm a new coder with greenfoot and a new coder overall. I'm having an error where I can't reference a non-static method (Wall.getY) from a static context here is the code and the error appears at every .get I plan to use this to find the position of the walls for a game where it is one of those puzzle sliding games. One appears in pokemon yellow at some point. if(Wall.getY() == y--) if(Wall.getX() == x) return false; else if (Wall.getX() /= x) return true; else if(Wall.getY() == y) return true;
Super_Hippo Super_Hippo

2016/11/15

#
'Wall' is a class, not an object. You can't get the position of a class. Instead, you need to get a reference to the object(s) and call the method on that.
You need to login to post a reply.