Originally Posted by
Fubarable
It's not really a scope issue but likely a reference issue or a focus issue. For a KeyListener to work, the component it is listening to must have focus. You can check to see if your key listener is active by adding some System.out.println statements in it and see if they print. If the KeyListener is working well, then again your issue could be one of reference -- that you're moving a Player object, but just not the currently visualized Player object. Understand that every time you call new Player(), you are creating a new and distinct Player object. If you want this class to act on a Player object that has been created elsewhere, you'll need to pass a reference of that Player object into this class, perhaps as the parameter of a setPlayer method.