Skip to main content
GameDev.net gamedev.net
🔒 Locked

Game Menu System

Started by Rob Loach Mar 21, 2003 at 1:41 PM 3 replies 250+ views
Original Post
Rob Loach
Rob Loach
Has anyone done one before? How is it implemented into the game? I''m done my game, just need to make a main menu and in-game menu and was wondering how they are done. _____________________________ - Rob Loach OverTech Technologies
Rob Loach [Website] [Projects] [
marcus12024
marcus12024
If you''ve done a whole game, then you shouldn''t need too much help with this, as a menu is much simpler (usually) then much of a game can be.

Anyway, try something like this:


  
bitmap choice1Off;
bitmap choice1On;
bitmap choice2Off;
bitmap choice2On;
// etc for more choices, assumes you''ve loaded in these bitmaps properly :) ;


// now for your menu code...;


int choice = 0; // set the first item as default choice


if (STATE == GAME_MENU) {
if (choice == 0) {
ShowBitmap(choice1On, xLoc, yLoc);
ShowBitmap(choice2Off, xLoc2, yLoc2);
} else {
ShowBitmap(choice1Off, xLoc, yLoc);
ShowBitmap(choice2On, xLoc2, yLoc2);
}

if (KEY_DOWN(VK_DOWN))
choice = (choice+1)%2; // allows looping (^_^)


// repeat for other keys here;

} // end if (STATE == GAME_MENU);




hope this helps


"The power is not in knowing what to do, but how to do it." -ME
Life's Short. Make Games.
Rob Loach
Rob Loach
Great, thanks a lot. So, inside the game loop, I would provide different game states. One for lets say PLAY_GAME, one for like INGAME_MENU, and a last one for MAIN_MENU?

So you would just change from one state to another depending on if the user is playing the game, in a ingame menu or at the main menu...... I''ll try it when I get home. Tell me if I''m wrong! heh

_____________________________

- Rob Loach
OverTech Technologies
Rob Loach [Website] [Projects] [
marcus12024
marcus12024
Nope, you''ve pretty much got it right...really simplifies the state transitions in your game this way. That''s how most people learn to program games these days, I think. But that''s just my opinion.

Good luck, and I wouldn''t mind seeing your game when you''re finished!!
Life's Short. Make Games.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.