Jump to content
  • Advertisement

Archived

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

JavaWillCome

[java] Java keyboard commands in Applets

This topic is 5171 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
Advertisement
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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!