m (Linking project SEMI_AUTOMATIC)
(Spicifying it a Super Bowl taco style)
Line 1: Line 1:
 
{{Merge|Indirect Start}}
 
{{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 beginning of a [[project]]. It allows the user to decide to play the game, or use other features within the project, such as character customization. Main menus mostly consist of various buttons for accessing the different parts of a project. For this tutorial, it is assumed that the majority of the project's body is complete.
 
 
For this tutorial, it is assumed that you have your game made without the menu.
 
  
 
==Basic Menu==
 
==Basic Menu==
 
+
[[Broadcast|Broadcasting]] is useful for main menus because it allows them to be easily pulled up multiple times in a project. It avoids the need to click the [[Green Flasg|green flag]] to navigate back to the menu. The broadcast used in this tutorial is named <code>openMenu</code>
[[Broadcast]]s you will need:
+
In order to start, you will need to replace most "When Green Flag Clicked" script with "When I receive [openMenu]" scripts, likely with exceptions. It's recommended to plan for this in advance, and not use "When Green Flag Clicked" hats for the main menu,
 
+
For example, one's original script might look like this:
'''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:
 
 
<scratchblocks> when gf clicked
 
<scratchblocks> when gf clicked
 
forever
 
forever
Line 45: Line 35:
 
end </scratchblocks>
 
end </scratchblocks>
  
After this, make a separate backdrop for your title screen that includes your title.
+
After this, make a separate backdrop for your title screen that includes your title and a new sprite named "Start Button". Inside this sprite, make two scripts:
 
 
Now, make a new sprite, and name it "Start Button"
 
Inside this sprite, make two scripts:
 
 
 
One will show it when the project starts,
 
 
<scratchblocks> when gf clicked
 
<scratchblocks> when gf clicked
 
show  
 
show  

Revision as of 01:19, 1 February 2014

DocumentInQuestion.png 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 beginning of a project. It allows the user to decide to play the game, or use other features within the project, such as character customization. Main menus mostly consist of various buttons for accessing the different parts of a project. For this tutorial, it is assumed that the majority of the project's body is complete.

Basic Menu

Broadcasting is useful for main menus because it allows them to be easily pulled up multiple times in a project. It avoids the need to click the green flag to navigate back to the menu. The broadcast used in this tutorial is named openMenu In order to start, you will need to replace most "When Green Flag Clicked" script with "When I receive [openMenu]" scripts, likely with exceptions. It's recommended to plan for this in advance, and not use "When Green Flag Clicked" hats for the main menu, For example, one's original script might 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 and a new sprite named "Start Button". Inside this sprite, make two scripts:

 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:

Note Note: 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.


External Links