I'm trying to create a mario-esque game in Java and am at the point of implementing a camera.
Following normalocity's example, I understand the difference between the
GameWorld and the
Camera that follows that objects within the context of the world.
From a technical perspective,
I have JFrame that adds
GamePanel (extends JPanel) and sets its size to 500,500 (that's the window size that I see pop up when I run the program).
Before learning about GameWorlds and such... I was using GamePanel as a generic JPanel to paint my objects and to implement boundary rules, timer, paintComponent, scoring, keyboard input, collision check... All painted objects are placed and shown relative to GamePanel's coordinates/size.
Now I'm trying to implement a Camera...
Is Camera a smaller JPanel added to the GamePanel? How do I make my GamePanel more like a GameWorld with a huge size (10,000 x 10,000 px), and only render everything on that GamePanel through the Camera JPanel?
From the GamePanel, I've tried altering the coordinates of the Camera using arrow keys... the camera coordinates of course change, but the objects painted on the GamePanel do not move with respect to the coordinates of the Camera.
EDIT: I'm using JPanel because that's what I'm familiar with. If you have a better suggestion on game dev in Java, please let me know!