<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ru">
	<id>http://digida.mgpu.ru/index.php?action=history&amp;feed=atom&amp;title=Creating_a_Main_Menu</id>
	<title>Creating a Main Menu - История изменений</title>
	<link rel="self" type="application/atom+xml" href="http://digida.mgpu.ru/index.php?action=history&amp;feed=atom&amp;title=Creating_a_Main_Menu"/>
	<link rel="alternate" type="text/html" href="http://digida.mgpu.ru/index.php?title=Creating_a_Main_Menu&amp;action=history"/>
	<updated>2026-05-18T22:00:25Z</updated>
	<subtitle>История изменений этой страницы в вики</subtitle>
	<generator>MediaWiki 1.44.0</generator>
	<entry>
		<id>http://digida.mgpu.ru/index.php?title=Creating_a_Main_Menu&amp;diff=1698&amp;oldid=prev</id>
		<title>Patarakin: 1 версия импортирована</title>
		<link rel="alternate" type="text/html" href="http://digida.mgpu.ru/index.php?title=Creating_a_Main_Menu&amp;diff=1698&amp;oldid=prev"/>
		<updated>2022-07-21T08:33:14Z</updated>

		<summary type="html">&lt;p&gt;1 версия импортирована&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;ru&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Предыдущая версия&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Версия от 11:33, 21 июля 2022&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;4&quot; class=&quot;diff-notice&quot; lang=&quot;ru&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(нет различий)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;!-- diff cache key digida:diff:1.41:old-1697:rev-1698 --&gt;
&lt;/table&gt;</summary>
		<author><name>Patarakin</name></author>
	</entry>
	<entry>
		<id>http://digida.mgpu.ru/index.php?title=Creating_a_Main_Menu&amp;diff=1697&amp;oldid=prev</id>
		<title>scratch&gt;TheTrillion: Fixed blocks.</title>
		<link rel="alternate" type="text/html" href="http://digida.mgpu.ru/index.php?title=Creating_a_Main_Menu&amp;diff=1697&amp;oldid=prev"/>
		<updated>2021-05-26T05:27:40Z</updated>

		<summary type="html">&lt;p&gt;Fixed blocks.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Новая страница&lt;/b&gt;&lt;/p&gt;&lt;div&gt;A [[Menu (project)#Types of Menus|&amp;#039;&amp;#039;&amp;#039;Main Menu&amp;#039;&amp;#039;&amp;#039;]] is a menu, usually used in games, placed at the beginning of a [[project]]. It allows the [[Scratcher|user]] to decide to play the [[Game Projects|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&amp;#039;s body is complete.&lt;br /&gt;
&lt;br /&gt;
== Basic Menu ==&lt;br /&gt;
[[Broadcast]]ing 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|green flag]] to navigate back to the menu. The broadcast used in this tutorial is named &amp;lt;code&amp;gt;open menu&amp;lt;/code&amp;gt;&lt;br /&gt;
In order to start, one will need to replace most &amp;quot;When Green Flag Clicked&amp;quot; script with &amp;quot;When I receive [open menu]&amp;quot; scripts, likely with exceptions. It&amp;#039;s recommended to plan for this in advance, and not use &amp;quot;When Green Flag Clicked&amp;quot; hats for the main menu,&lt;br /&gt;
For example, one&amp;#039;s original script might look like this:&lt;br /&gt;
&amp;lt;scratchblocks&amp;gt;&lt;br /&gt;
when gf clicked&lt;br /&gt;
forever&lt;br /&gt;
if &amp;lt;key (left arrow v) pressed?&amp;gt; then&lt;br /&gt;
change x by (-10)&lt;br /&gt;
end&lt;br /&gt;
if &amp;lt;key (right arrow v) pressed?&amp;gt; then&lt;br /&gt;
change x by (10)&lt;br /&gt;
end&lt;br /&gt;
if &amp;lt;key (space v) pressed?&amp;gt; then&lt;br /&gt;
jump::custom&lt;br /&gt;
end &lt;br /&gt;
&amp;lt;/scratchblocks&amp;gt;&lt;br /&gt;
But after the modification, it would look like this:&lt;br /&gt;
&amp;lt;scratchblocks&amp;gt;&lt;br /&gt;
when I receive [start game v]&lt;br /&gt;
forever&lt;br /&gt;
if &amp;lt;key (left arrow v) pressed?&amp;gt; then&lt;br /&gt;
change x by (-10)&lt;br /&gt;
end&lt;br /&gt;
if &amp;lt;key (right arrow v) pressed?&amp;gt; then&lt;br /&gt;
change x by (10)&lt;br /&gt;
end&lt;br /&gt;
if &amp;lt;key (space v) pressed?&amp;gt; then&lt;br /&gt;
jump::custom&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/scratchblocks&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After this, make a separate backdrop for the title screen that includes the title and a new sprite named &amp;quot;Start Button&amp;quot;. Inside this sprite, make two scripts:&lt;br /&gt;
&amp;lt;scratchblocks&amp;gt;&lt;br /&gt;
when I receive [open menu v]&lt;br /&gt;
show&lt;br /&gt;
switch backdrop to (title backdrop v)&lt;br /&gt;
&amp;lt;/scratchblocks&amp;gt;&lt;br /&gt;
The &amp;quot;Play&amp;quot; button is used for triggering the project to begin. Most often, when the button is clicked a message will be sent signaling the game to begin. The following script represents this:&lt;br /&gt;
&amp;lt;scratchblocks&amp;gt;&lt;br /&gt;
when this sprite clicked&lt;br /&gt;
broadcast (start game v)&lt;br /&gt;
switch backdrop to (gameplay backdrop v)&lt;br /&gt;
hide&lt;br /&gt;
&amp;lt;/scratchblocks&amp;gt;&lt;br /&gt;
Now when someone starts the project, it will show the menu instead of starting the game automatically.&lt;br /&gt;
&lt;br /&gt;
== Adding Title Music ==&lt;br /&gt;
&lt;br /&gt;
Title music can be added to the game.&lt;br /&gt;
&lt;br /&gt;
Make the following required [[Variable]]:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;scratchblocks&amp;gt;&lt;br /&gt;
(main menu?)&lt;br /&gt;
&amp;lt;/scratchblocks&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In any [[sprite]], create a script like this one:&lt;br /&gt;
&lt;br /&gt;
{{note|Do this after the menu has been created. Do not convert this into a &amp;quot;start game&amp;quot; script.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;scratchblocks&amp;gt;&lt;br /&gt;
when gf clicked&lt;br /&gt;
set [main menu? v] to (1)&lt;br /&gt;
forever&lt;br /&gt;
if &amp;lt;(main menu?)&amp;gt;[0]&amp;gt; then&lt;br /&gt;
play sound (Title Music v) until done&lt;br /&gt;
end &amp;lt;/scratchblocks&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This script says that if the viewer is on the main menu, it will play the music.&lt;br /&gt;
&lt;br /&gt;
Now, modify the Start Button script. Change it from this:&lt;br /&gt;
&amp;lt;scratchblocks&amp;gt;&lt;br /&gt;
when this sprite clicked&lt;br /&gt;
broadcast (start game v)&lt;br /&gt;
switch backdrop to (gameplay backdrop v)&lt;br /&gt;
hide&lt;br /&gt;
&amp;lt;/scratchblocks&amp;gt;&lt;br /&gt;
to this:&lt;br /&gt;
&amp;lt;scratchblocks&amp;gt;&lt;br /&gt;
when this sprite clicked&lt;br /&gt;
broadcast (start game v)&lt;br /&gt;
set [main menu? v] to (0)&lt;br /&gt;
stop all sounds&lt;br /&gt;
switch backdrop to (gameplay backdrop v)&lt;br /&gt;
hide&lt;br /&gt;
&amp;lt;/scratchblocks&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This prevents the title music from playing again, and then just stops it altogether.&lt;br /&gt;
&lt;br /&gt;
== External Links ==&lt;br /&gt;
&lt;br /&gt;
* [[projects:243051|How to Make a Title Screen]] {{-}} A tutorial that teaches how to make a title screen.&lt;br /&gt;
&lt;br /&gt;
[[Category:Scripting Tutorials]]&lt;br /&gt;
[[Category:Game Design Tutorials]]&lt;/div&gt;</summary>
		<author><name>scratch&gt;TheTrillion</name></author>
	</entry>
</feed>