Jump to content
  • Advertisement
Sign in to follow this  
amatsuki

[java] how to restart a game?

This topic is 3169 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

Hi everyone. I'm making a little game for an assignment. After the game is done I want to give the player the option to restart my game. How do I go on about this? so far what i came up with is instead of having a button for a restart i choose to do keyboard pressing. So if the player presses r they it would restart the game new. But that is the part I'm stuck at. Actually making the key work. Can anyone give me some suggestion. Please and thank you ^^

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by CaptainJester
java.awt.event.KeyListener


To add to that: it's a interface so you will have to implement it in your game class. Then add it to the Frame or Canvas with the addKeyListener() method. Use the KeyEvent in the implemented method to get the key you want.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • 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!