I am currently making a game and am working on the town code right now. I have booleans for the areas in and out of the town, but when I go to leave an area it resets me back at the beginning of the program. I have it set to when you go into an area, a boolean turns true and the area becomes available. But when I go to leave it keeps turning off the town boolean as well. I am using a simple 'quit' or 'leave' command to leave the areas.
(I am utilizing IF statements for the areas)

(Text-Based Java Game)

Any advice on this would be appreciated.

When I type 'quit' or any word that is not available it also return me to the beginning.

Edited by gotto: More info

5 Years
Discussion Span
Last Post by Adak

I changed the IF statements to WHILE loops and now it keeps me in the correct area.


Your character should have struct members which define all his attributes in any given area. If not, the area should have that info, so your player has everything he's earned, wherever he goes (some of it may not be functional in some area's, but he still has it).

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.