@anne O'nymous pretty well recited the options.
To extend just slightly, the most common paradigm I've seen for what you're trying to do is to create a screen and then call the screen. (The other methods mentioned work, but they're probably sub-optimal for navigation.)
Calling a screen (as opposed to just showing it) creates an interaction for the player. (i.e. waits for player input) You can easily prototype the screen using just text buttons inside a vbox until later when you have your actual graphics, etc.
From within the screen, you have essentially two choices to leave:
- When you click on a button (to go somewhere), the screen can Return("some string"). (In other words, the "action" for the button is Return("some string") This will return control back to just after your "call screen" statement, and "some string" will be assigned to the "_return" variable. At that point, you can test the value in the _return variable and do whatever you need to do.
- Instead, you can have the "action" for the button be Jump("someLabel"), in which case control will be directly transferred to the label in question instead of returning back to where the "call screen" was.
Note that in the latter case, you cannot pass parameters to the label. However, what you can do is something like
Code:
action [SetVariable("variableName","value"),Jump("someLabel")]
In other words, the action for the button can be an array of actions, which will be executed in sequence. This allows you to set a variable (or do something else) before you jump, and then the code on the other end of the jump can use the value in the variable (as
@anne O'nymous said).
Again, at least IMHO, the "Jump" option is probably the superior one if you're doing in-game navigation across multiple rooms or whatever. Basically, you have a screen for each room, the room-to-room buttons jump to labels where you call the correct screen for the room you're in, and then the "oh, I can do something other just go to another room" buttons jump to the appropriate portion of the dialog. (Or, when you jump to a room label, the first thing you do is check "is there any dialog to be shown" and once that's been handled, you call the screen to find out where the player wants to go next.)
That approach makes for a pretty modular game, which should be reasonably easy to maintain.
Finally, as a side note, you should probably look at imagebutton's before you look at imagemap's. In other words, create a background for the scene, and then overlay imagebuttons at the appropriate (x,y) points. Imagemap's certainly work, and for some people they're a bit more "obvious," but imagebuttons are somewhat more flexible, and tend to require less graphics rework if you decide to add a new button as your game evolves.
Again, just my $0.02. The paradigms that make sense to one person may be foreign to another, and vice versa, so your mileage may vary.