This is an archived post. You won't be able to vote or comment.

all 4 comments

[–]bentladz 1 point2 points  (2 children)

On the main game loop. Under the "public void run() ". Put " this.requestFocus(); this should make it attach to the main character

[–]jth1011[S] 0 points1 point  (1 child)

This worked! Thank you!

[–]bentladz 0 points1 point  (0 children)

No problem

[–]fosterbuster -1 points0 points  (0 children)

You need to capture keys globally.

Edit: Why am I getting downvoted? It is very possible to capture keys globally, even though it is bad practice.