Archived

This topic is now archived and is closed to further replies.

[java] Java keyboard commands in Applets

This topic is 4953 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Im attempting to write a 2D rogue-like RPG java game in an applet, in which a character moves around a grid and interacts with the world. My biggest problem is starting the game when the player must choose his character information (Sex, Race, Class, Diety, ect.) I currently have one Keylistener on the applet with a switch case statement for the state of the game, corresponding to the screen that is up. Is there anyway to create more than one key listener in an applet? Or a simpler way to do this? Is there any method that brings up another applet?

Share this post


Link to post
Share on other sites
quote:
I currently have one Keylistener on the applet with a switch case statement for the state of the game, corresponding to the screen that is up.


That sounds like a pretty good design. Multiple KeyListeners would be overkill. Maybe you just need to refine it a bit more; like limit your states to IN_GAME and IN_MENU and make the IN_MENU state generic enough to support different menus?

Share this post


Link to post
Share on other sites