Jump to content
  • Advertisement
Sign in to follow this  

pop up menu for rpg game [Urgent Help required]

This topic is 2963 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!