Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How to make a restart in a text based game.  RSS feed

 
noury kraaikamp
Greenhorn
Posts: 5
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello im Noury im 14 years old and im new to java, i made a small text based game but at the end i want a restart function i couldn't do anything because everything i tried failed for some reason.
i also searched on internet for it and that is how i came to this site but there was no topic on this.

can somoene tell me how to make a reset in a text based game.
 
Roel De Nijs
Marshal
Posts: 10996
161
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Noury,

First of all, a warm welcome to the CodeRanch!

14 years and already discovering the wonderful world of Java. Cool! When I was your age I was only thinking about football, no computers for me, let alone making text-based games

can somoene tell me how to make a reset in a text based game.

You didn't provide much details about your game, so it's hard to give good hints/suggestions.

But what about running the game until a specific character is entered by the user?

I have written a very simplistic game which decides if an integer is odd or even.


Now I can add a loop (in the main method) to run this program until the user enters 0.


Hope it helps!
Kind regards,
Roel
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There's also a lengthy writeup about text input at http://www.coderanch.com/how-to/java/UserInput. (Actually, it's 3 parts, but the first part alone should keep you busy for a while.)
 
noury kraaikamp
Greenhorn
Posts: 5
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sorry this is deleted
 
noury kraaikamp
Greenhorn
Posts: 5
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Roel De Nijs wrote:Hi Noury,



Hope it helps!
Kind regards,
Roel



hi roel thanks for helping but i dont have my game like that it is much bigger and more complex.
if you want i can put a download link here so you can download it and help me more.

but still i realy apriceate that you helped me
 
noury kraaikamp
Greenhorn
Posts: 5
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
guys i don't need help anymore i solved the problem but thanks if you helped and if you wanted to help
 
Roel De Nijs
Marshal
Posts: 10996
161
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
noury kraaikamp wrote:guys i don't need help anymore i solved the problem but thanks if you helped and if you wanted to help

Glad to hear you solved your issue!

To help others it's always nice if you shared your solution. It's of course not needed to share the complete code, but a little explanation or a small code snippet is highly appreciated. It could help others solving a similar problem.
 
noury kraaikamp
Greenhorn
Posts: 5
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Roel De Nijs wrote:
noury kraaikamp wrote:guys i don't need help anymore i solved the problem but thanks if you helped and if you wanted to help

Glad to hear you solved your issue!

To help others it's always nice if you shared your solution. It's of course not needed to share the complete code, but a little explanation or a small code snippet is highly appreciated. It could help others solving a similar problem.


the only thing i did was made a class reset that was called when the player typed reset that resetted all the settings to default and started the game from the beginning
so it wasn't that hard to do after all
 
Roel De Nijs
Marshal
Posts: 10996
161
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for coming back and sharing your solution (might be helpful for other ranchers). That is not always the case, therefore have a cow!
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!