So, my game is starting to get a bit cluttered and I’ve been thinking about trying to divide parts into separate classes, and I must admit that my inexperience with Java is catching up to me. I have Character and Projectile classes, but what I would like to have is an InGame class, Menu class, and LevelLoader class which are currently methods inside the main class. The problems that I don’t already know the answers to:
-The levelLoader methods create images which are declared in the main declaration section, and are used in the main loop run() for inGame purposes. Can Images/any variable or object be passed as arguments as not read only, or can I access the parrent class’s global variables some how?
-The Menu method shares the same keyboard and mouse listeners as the in game code. I’m assuming I can have a Menu class with mouse and keyboard listeners, I don’t know if I need to remove the in game listeners before adding listeners in the Menu class, or the proper way to do this. Also, the update() and paint() methods check to see what to draw (game/menu) and does so accordingly. If I want the them to have separate drawing methods how would I do that?
Thanks in advance.