Sign in to follow this  
RojanShrestha

pop up menu for rpg game [Urgent Help required]

Recommended Posts

I am currently working on a turn based rpg game. So far I have:
1. Loaded map from txt files using 32X32 tiles.
2. Loaded objects of the map in a similar way.
3. Collision Detection between objects and player also works fine.

Now the question is:
How would I implement pop up menus for different objects in the game? I have an object class that loads all the objects from the txt file and draws them on screen.

Share this post


Link to post
Share on other sites
Depends greatly on what exactly your using. The way I would do it (and that does not mean its the right way) would be to use some sort of state machine. The game can be in one state at a time, a main menu state, option screen state, pause menu state, main game state, interactive popup type state, etc etc. A state may do a few things, some of which might be - render, update, handle input.

I would have a main game state, that does all your gameplay type stuff. When I want to interact with an item say, I might create a new state "Interact with object", its going to look different, its going to handle user input differently etc but its all container quite seperately from the main game state.

How you actually implement all this is another question and I would definately do a little reading around. Googling "Game state machine" gave a few results so you could start there.

I would definately suggest taking a look into this as it allows you to cleanly do things like menus/credits/loading screens and so on.

A base state might look like:

class GameState
{
virtual void OnRender();
virtual void OnUpdate();
virtual void OnUserInput(Input input);
};

You can then sub class it to make states of varying types, a games OnUserInput method might use the wasd keys to move around but a dialog type state may ignore them. It would be useful to create a state machine then to hold the states (it could update/render/pass input to the current state).

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this