vendredi 25 septembre 2015

Easiest way to implement a game menu in ActionScript 3?

At the moment my game simply consists of a play button which, when clicked, runs the game; all of this happens in the document class as follows:

stage.addChild(playBtn);
playBtn.x = 0;
playBtn.y = stage.stageHeight/2;;
playBtn.addEventListener(MouseEvent.CLICK, playGame);

The playGame() function then removes playBtn from the stage and the event listener, and runs the game code. This has been fine for me up until now, but now I want to implement a more complex menu system, which will probably consist of many buttons, graphics, etc (basically a stage select screen). My question is, what would be a more efficient way of displaying a menu on the screen, removing it when a stage is selected and then being able to return to the menu when the game is over? Obviously I'm trying to do all of this without the use of the timeline.

Aucun commentaire:

Enregistrer un commentaire