[java] how to restart a game?
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 ^^
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.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement