I am a beginner Java programmer and I have made a very simple applet with the wonderful help of some great YouTube tutorials and I was wondering if you guys knew of anyway of making a button that restarted the game without having to exit and reload the game manually. Here is my main class:
Any suggestions or code alterations would be so gratefully received also any other comments on the code would be nice as well.
Thanks
PlumApps
Michael Dunn
Ranch Hand
Joined: Jun 09, 2003
Posts: 4632
posted
0
create a method, separate to init() or start(), named reset()? and put your current start-up code there.
ensure you set any variables to their starting state (except for games won/lost etc).
call reset() when the applet first opens, then for a new game call reset() again,
and the screen should appear exactly as when the applet first opened.