Skip to main content
September 19, 2011
Question

How do main menu's work in OOP?

  • September 19, 2011
  • 2 replies
  • 586 views

Im making a OOP game. Using classes ect. But how does the main menu system work? Well Im not full OOP yet i guess. the player spawn point and level boundaries are all visually set up on frame one. But im unsure as how main menu sytems ever worked OOP or not. Please can someone explain to me how this works...... Many thanks

This topic has been closed for replies.

2 replies

September 20, 2011

I would look at the menu like a game module. Your controller would play the 'game' module, or the 'high score' module or the 'menu'. The controller decides which 'module' to show... like at game start show menu, when game play is done, show the high scores, then the menu, etc.

September 20, 2011

Thanks ned. I Would provide a method in which i have trieb but im unsure as how to start.

something like this maybe:

public var _start:StartButton = new StartButton;

public var _Instruction:IntructionsButton = new IntructionsButton

public function main()

{

     addChild(_Start);

     addChild(_Instruction);

     manageMenu()

}

private function manageMenu():void

{

     _Instruction.visible = false;

     _Start.visible = true;

     _Instruction.addEventListener(MouseEvent.CLICK, showInstruction)

}

private function showInstruction(MouseEvent):void

{

     _Start.visible = false;

     _Instrcution.visible = true;

}

thats all i can think of right now. (as for the menu)

Ned Murphy
Legend
September 20, 2011

There are likely any number of main menu systems that one could create.  You'll need to have some specific information regarding what your main menu will do and how it will work.  And it never hurts to try something and present it rather than just ask someone to provide a design solution or tutorial for you.