VG:Main Menu

From MyProjectFun
Jump to: navigation, search

Making a main menu is relatively simple. You need Menu level which has sprites for buttons. Each button should have a specific thing to do when clicked on - so the trick is figuring out how to click on a button.

If you want to implement a Play button, you would have the following behavior attached to your play button sprite:

// Behavior for a play button
public static void PlayButtonFN()
  // If we're colliding with the cursor sprite
  // and the player is triggering left click
  if (This.Sprite.CollisionWithSprite("Cursor" ) != null && This.Game.IsMouseTriggered(0))
    // Go to the arena level
    This.Game.SetCurrentLevel("ArenaLevel" );
As for other buttons, you would likely want a level for each submenu (such as instructions or credits) with a back button that returns to the menu level.

There's a lot of names there that you'll need to make sure match your game. This includes the cursor name and the level name. Aside from that, it should work.

Personal tools
Game Design
Multimedia Production
VG Programming