No doubt it IS actually useful in more advanced stages, but for a beginner like me? :-
I could go on youtube tutorials, and that is what I’ve done up until now, but I don’t want to follow a tutorial f you know what I mean.
ONE final problem, I’m sure it can be fixed with one line of code. How do I make it so that the keyboard automatically works without me having to click in the window?
What do you mean by the keyboard automatically working? Detecting key presses? (that’s not possible)
I have a key listener, listening for: enter, shift and control. The window IS the active window upon startup, but before the keyListener can actually pick up anything I have to click the canvas (inside the borders).
call requestfocus() on the canvas
The class with main in it, “Game”, extends canvas and never actually uses it anywhere else. Should it be on the JFrame instead? because that doesn’t work. ???
OK I’m being silly it extends canvas so it can use things like the mouse and bufferstrategies, how would I use the requestFocus() on the Canvas then?
in this case just put
requestFocus();
in your initialization code