Hi everyone in my game I'm trying to make a door open with a key i put it like this.
I have a class door, a class Player and a class key and i put it like this
It's not working i have a java.lang.NullPointerException when i touch the door can anyone help please thanks
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | private boolean key = false ; public void key() { if (isTouching(key. class )) { boolean key = true ; } } public void remove_door() { if (isTouching(door. class )) { if (key= true ) { w1.removeObject(d); } } } |