I'm making a text adventure game, and it's actually coming along quite nicely...the only thing is, I want to be able to return to the previous screen whenever I want.

Say that in my game, I go north. I want to be able to go south, back to my main screen. (I'm doing switch & cases in here btw.) So what do I do? I can't do a case 'S' because there's already one for going south on the main screen.
So, I got this idea: I can put the main part of my game (the four paths I can take at the beginning) into a separate file and call it whenever. I don't really know how to do that though.

And then I started thinking..."What if I was 5 screens away from the paths instead of just 1? I wouldn't be able to just 'jump' to the beginning..."

So can anyone help me? here's the link for my code...

btw, just ignore the "window closing out" comment...I got that fixed.

::edit::
okay.....I found out something I didn't know and now I can do other stuff....But i still need help with the original problem...

Recommended Answers

All 3 Replies

okay..sorry about DP but...I have a brand new problem.
On my latest code, it doesn't matter what I press after I get an option to do something...
example: "You fell from a 9 story building and can't move. What do you do?
[C]all an ambulance? or just lay there?
>alsk;djfl;kasjfd *presses enter*
"You have called the ambulance and now it is on it's way.."

what now?

new code: here

You know what? I'm giving this up and doing it in python...people seem to have better success there...

Well in the code that you have mentioned i dont see the code of the ambulance call . All i just see is other code. There is some other code though. You should paste the code that you have worked out on the compiler so that we can sovle it.

well, that was just an example...but what I meant is no matter what I entered, as long as it was at least one letter, then it did the next case. And when there was more than one case, it did the second one after the first one got done...it was really messed up. But I gave up on that and now i'm doing one with python!

here's the thread for the game in python....anyone here who knows python please take a look at it! link

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.