Results 1 to 9 of 9
Thread: A "Go back" statement
- 01-05-2012, 02:35 PM #1
Member
- Join Date
- Oct 2011
- Posts
- 16
- Rep Power
- 0
A "Go back" statement
Hi,
I'm making a game with serveral rooms. It is a text game.
But now i got a problem... How do i manage to take them back to the previous room?
Example: He was in the kitchen--> he goes to the bathroom. Now i want that he goes back to the bathroom if i enter the command "Back".
Some idea's?
- 01-05-2012, 02:45 PM #2
Re: A "Go back" statement
Very hard to say without seeing your code structure.How do i manage to take them back to the previous room?
Typically you go back with a loop.
Or you could use a Stack.
When you enter a room push the current location onto the Stack.
When you exit a room, pop off the previous location to be the current location.
- 01-05-2012, 02:55 PM #3
Member
- Join Date
- Oct 2011
- Posts
- 16
- Rep Power
- 0
Re: A "Go back" statement
Oke i managed to make a "stack", now i want to run it, Do i need to save it as a .jar file and how can i run it?
- 01-05-2012, 02:58 PM #4
Re: A "Go back" statement
You don't need a jar to run/execute your program. Open a command prompt window, change to the folder with the class files and use the java command to start execution of your program.
- 01-05-2012, 03:10 PM #5
Member
- Join Date
- Oct 2011
- Posts
- 16
- Rep Power
- 0
Re: A "Go back" statement
But i want a file so i can excute the game
- 01-05-2012, 03:13 PM #6
Re: A "Go back" statement
I thought you'd want to test it before packaging it.
You do not need to put the files in a jar for testing.
- 01-05-2012, 03:53 PM #7
Member
- Join Date
- Oct 2011
- Posts
- 16
- Rep Power
- 0
Re: A "Go back" statement
So i can make of my java files a .exe and can i make of .jar a .exe?
- 01-05-2012, 03:56 PM #8
Re: A "Go back" statement
I don't know anything about making a .exe file.
If you don't know how java programs work, you should read this:
"Hello World!" for Microsoft Windows (The Java™ Tutorials > Getting Started > The "Hello World!" Application)
- 01-06-2012, 04:11 PM #9
Re: A "Go back" statement
It is possible to bundle java apps into an .exe, but that makes them platform dependent, which defeats the entire point of java. You cannot make a 'jar' of an exe, at least not in the way I think you mean. A jar is basically a zip file with some extra meta information that that JVM understands how to open and execute byte code from. While you could include an exe in a jar file, I don't see why you would, and once again, this would be platform dependent.So i can make of my java files a .exe and can i make of .jar a .exe?
Similar Threads
-
An "if" statement inside a "for" loop?
By soccermiles in forum New To JavaReplies: 18Last Post: 04-20-2010, 03:44 AM -
Simple "if" statement problem....compiling error.
By CYANiDE in forum New To JavaReplies: 4Last Post: 10-14-2009, 09:56 PM -
[SOLVED] Why does the compiler return "not a statement" for this method body please?
By trueblue in forum New To JavaReplies: 3Last Post: 05-25-2009, 08:50 PM -
"Cached Item Was Locked" causing Select Statement: Hibernate + EHCache
By cloutierm in forum Advanced JavaReplies: 0Last Post: 03-15-2009, 11:53 PM -
the dollar sign "$", prints like any other normal char in java like "a" or "*" ?
By lse123 in forum New To JavaReplies: 1Last Post: 10-20-2008, 07:35 AM


1Likes
LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks