Handling graphics and keyEvents in other classes?
I am making a game in Java as an applet. The game runs fine, but the code is growing larger as I'm implementing more features, so I'd like to orgainzationally branch off by putting code into other classes.
Now, I'm aiming to create a menu screen. I could add all of the necessary code to the same .java file, but it would be too bulky. What I'm trying to do is temporarily switch the flow of the class to another (we'll call it MenuScreen).
The tricky part is, this requires:
- Graphics handling (on the same applet)
- Another KeyListener for MenuScreen
- A thread of its own
How can I do this? I've been trying to accomplish this for over a week, and nothing seems to be working.
If more information would help finding an answer, I'll be happy to post parts-- or all--of the code. Any help or suggestions you can give me would be great. Thanks in advance.
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center