(use the merge template instead of the not helpful one in this case) |
m |
||
Line 1: | Line 1: | ||
− | {{Merge| | + | {{Merge|Indirect Start}} |
A '''Main Menu''' is a menu, usually used in games, placed at the start of the project where the user can decide to play the game, or use other features within the project, such as character customization. | A '''Main Menu''' is a menu, usually used in games, placed at the start of the project where the user can decide to play the game, or use other features within the project, such as character customization. | ||
Revision as of 20:00, 24 January 2014
![]() |
It has been suggested that this page's contents be merged with the page Indirect Start. You can discuss this on the page's talk page. (Date?) |
A Main Menu is a menu, usually used in games, placed at the start of the project where the user can decide to play the game, or use other features within the project, such as character customization.
For this tutorial, it is assumed that you have your game made without the menu.
Basic Menu
Broadcasts you will need:
start_game
In order to start, you will need to replace every "When Green Flag Clicked" script with "When I receive [start_game]" scripts. It's recommended to plan for this in advance, and not use "When Green Flag Clicked" hats.
For example:
Your original script would look like this:
when gf clicked forever if <key [left arrow v] pressed?> point in direction (-90) move (10) steps end if <key [right arrow v] pressed?> point in direction (90) move (10) steps end if <key [space v] pressed?> broadcast [jump v] end
But after the modification, it would look like this:
when I receive [start game v] forever if <key [left arrow v] pressed?> point in direction (-90) move (10) steps end if <key [right arrow v] pressed?> point in direction (90) move (10) steps end if <key [space v] pressed?> broadcast [jump v] end
After this, make a separate backdrop for your title screen that includes your title.
Now, make a new sprite, and name it "Start Button" Inside this sprite, make two scripts:
One will show it when the project starts,
when gf clicked show switch backdrop to [Title Backdrop v]
and another starts the game when it's clicked.
When this sprite clicked broadcast [start_game v] switch backdrop to [Gameplay Backdrop v] hide
Now, when someone starts the project, it will show the menu instead of starting the game automatically.
Adding Title Music
You can also add title music to your game.
Variables you will need:
(Main Menu?)
In any sprite, create a script like this one:
![]() | Do this after you've created your menu. Do not convert this into a "start_game" script. |
when gf clicked set [Main Menu? v] to (1) forever if <(Main Menu?)>[0]> then play sound [Title Music v] until done end
This script says that if you are on the main menu, it will play the music.
Now, you will need to modify your Start Button script: Change it from this:
when this sprite clicked broadcast [start_game v] switch backdrop to [Gameplay Backdrop v] hide
to this:
when this sprite clicked broadcast [start_game v] set [Main Menu? v] to (0) stop all sounds switch backdrop to [Gameplay Backdrop v] hide
This cuts off the supply of title music, and the just stops it altogether.