This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2012-07-29 22:18:34

lithor
New Scratcher
Registered: 2012-07-25
Posts: 13

Making a Main Menu

Hello ^^ This is my second question ive posted in the scratch forum.
Is there any way to make a Main menu, i already have button images i can use as sprites.
I want the Main menu to have the following options;
Start Game
Instructions

Hope someone has a solution ^^

Offline

 

#2 2012-07-29 23:19:47

lithor
New Scratcher
Registered: 2012-07-25
Posts: 13

Re: Making a Main Menu

bump

Offline

 

#3 2012-07-29 23:35:27

soupoftomato
Scratcher
Registered: 2009-07-18
Posts: 1000+

Re: Making a Main Menu

(on the sprite of the button "start game" which can be named anything, I use startgamesprite here)

when gf clicked
show 
when [startgamesprite] clicked
broadcast [start v]
hide
(on the sprite for "instructions" which can be named anything, I use instructionsprite here)
when gf clicked
show
when [instructionsprite] clicked
broadcast [instructions v]
hide
Now, when these broadcast, everything related to either starting the game, or showing the instruction, must have a script saying "When I receive []" with the proper broadcast in the blank and the rest of the script should be the actions it needs to take.

You may want a special background to show on the menu. Simply switch to it at the beginning, then change to what you need with a broadcast.


I'm glad to think that the community will always be kind and helpful, the language will always be a fun and easy way to be introduced into programming, the motto will always be: Imagine, Program, Share - Nomolos

Offline

 

#4 2012-07-30 00:17:26

lithor
New Scratcher
Registered: 2012-07-25
Posts: 13

Re: Making a Main Menu

Thank you, ill try it tomorrow, its pretty late here  smile  Try the game, its named Diamond Boreness, but try the BETA since it more developed.

Offline

 

#5 2012-07-30 07:52:19

ErnieParke
Scratcher
Registered: 2010-12-03
Posts: 1000+

Re: Making a Main Menu

soupoftomato wrote:

(on the sprite of the button "start game" which can be named anything, I use startgamesprite here)

when gf clicked
show 
when [startgamesprite] clicked
broadcast [start v]
hide
(on the sprite for "instructions" which can be named anything, I use instructionsprite here)
when gf clicked
show
when [instructionsprite] clicked
broadcast [instructions v]
hide
Now, when these broadcast, everything related to either starting the game, or showing the instruction, must have a script saying "When I receive []" with the proper broadcast in the blank and the rest of the script should be the actions it needs to take.

You may want a special background to show on the menu. Simply switch to it at the beginning, then change to what you need with a broadcast.

You may have to add the 1st and 2nd scripts to both buttons to make them show/hide only when you want them to. And then you'll need a button to get you back to the menu from instructions. The 3rd to 5th scripts are the scripts for that third button:

when I  receive [end instructions v]
show

when I receive [instructions v]
hide

when gf clicked
hide

when I receive [instructions v]
show

when [back to menu sprite] clicked
broadcast [end instructions]
hide

Last edited by ErnieParke (2012-07-30 07:59:04)


http://i46.tinypic.com/35ismmc.png

Offline

 

#6 2012-07-30 10:15:38

soupoftomato
Scratcher
Registered: 2009-07-18
Posts: 1000+

Re: Making a Main Menu

ErnieParke wrote:

soupoftomato wrote:

(on the sprite of the button "start game" which can be named anything, I use startgamesprite here)

when gf clicked
show 
when [startgamesprite] clicked
broadcast [start v]
hide
(on the sprite for "instructions" which can be named anything, I use instructionsprite here)
when gf clicked
show
when [instructionsprite] clicked
broadcast [instructions v]
hide
Now, when these broadcast, everything related to either starting the game, or showing the instruction, must have a script saying "When I receive []" with the proper broadcast in the blank and the rest of the script should be the actions it needs to take.

You may want a special background to show on the menu. Simply switch to it at the beginning, then change to what you need with a broadcast.

You may have to add the 1st and 2nd scripts to both buttons to make them show/hide only when you want them to. And then you'll need a button to get you back to the menu from instructions. The 3rd to 5th scripts are the scripts for that third button:

when I  receive [end instructions v]
show

when I receive [instructions v]
hide

when gf clicked
hide

when I receive [instructions v]
show

when [back to menu sprite] clicked
broadcast [end instructions]
hide

Why would you go back to the menu again?


I'm glad to think that the community will always be kind and helpful, the language will always be a fun and easy way to be introduced into programming, the motto will always be: Imagine, Program, Share - Nomolos

Offline

 

#7 2012-07-30 10:24:41

ErnieParke
Scratcher
Registered: 2010-12-03
Posts: 1000+

Re: Making a Main Menu

If you go into the instructions page, then you need to go back to the menu so that you can press play. The reason for this is because the play button (in my opinion) shouldn't appear in the instructions which is because an instructions page is a page for instruction, not a menu. A menu is what is supposed to have the play button, so that is why I recommend these scripts, but it is your choice.

The alternate option is that you can make it so that you can press play both in the menu and in the instructions page. This would already be implemented if your using only soupoftomato's scripts and not both of ours.

Anyway, I hope that you have fun scripting!


http://i46.tinypic.com/35ismmc.png

Offline

 

#8 2012-07-30 19:38:07

mwiedmann
New Scratcher
Registered: 2012-07-30
Posts: 12

Re: Making a Main Menu

Another way that I like to do it is to create a background that already has your main menu buttons as part of the bitmap. Then on the stage you can capture the mouse clicks and check the mouse x/y coordinates to see what button they clicked on. You then switch to your "instructions" background and show the instructions or start the game. Makes it so you don't have to manage so many sprites, but it bloats your project slightly with extra background images.

Offline

 

#9 2012-07-30 20:22:46

ErnieParke
Scratcher
Registered: 2010-12-03
Posts: 1000+

Re: Making a Main Menu

mwiedmann wrote:

Another way that I like to do it is to create a background that already has your main menu buttons as part of the bitmap. Then on the stage you can capture the mouse clicks and check the mouse x/y coordinates to see what button they clicked on. You then switch to your "instructions" background and show the instructions or start the game. Makes it so you don't have to manage so many sprites, but it bloats your project slightly with extra background images.

That's a nice idea and I already use it for some of my projects, but what if your buttons are circles or have rounded edges?

Last edited by ErnieParke (2012-07-30 20:23:02)


http://i46.tinypic.com/35ismmc.png

Offline

 

#10 2012-07-30 21:40:35

lithor
New Scratcher
Registered: 2012-07-25
Posts: 13

Re: Making a Main Menu

This is complicated XD. I cant seem to understand how to change the background again when clicking the Start button  sad
any help?

Offline

 

#11 2012-07-30 22:01:06

ErnieParke
Scratcher
Registered: 2010-12-03
Posts: 1000+

Re: Making a Main Menu

Put this in the menu:

when gf clicked
switch to costume [background menu v]

when I receive [start v]
switch to costume [background game v]
Hope that this helps!

Last edited by ErnieParke (2012-07-30 22:02:50)


http://i46.tinypic.com/35ismmc.png

Offline

 

#12 2012-07-30 23:22:53

lithor
New Scratcher
Registered: 2012-07-25
Posts: 13

Re: Making a Main Menu

ErnieParke wrote:

Put this in the menu:

when gf clicked
switch to costume [background menu v]

when I receive [start v]
switch to costume [background game v]
Hope that this helps!

What does "When i Recieve" Means?

Offline

 

#13 2012-07-31 00:45:58

lithor
New Scratcher
Registered: 2012-07-25
Posts: 13

Re: Making a Main Menu

ErnieParke wrote:

soupoftomato wrote:

(on the sprite of the button "start game" which can be named anything, I use startgamesprite here)

when gf clicked
show 
when [startgamesprite] clicked
broadcast [start v]
hide
(on the sprite for "instructions" which can be named anything, I use instructionsprite here)
when gf clicked
show
when [instructionsprite] clicked
broadcast [instructions v]
hide
Now, when these broadcast, everything related to either starting the game, or showing the instruction, must have a script saying "When I receive []" with the proper broadcast in the blank and the rest of the script should be the actions it needs to take.

You may want a special background to show on the menu. Simply switch to it at the beginning, then change to what you need with a broadcast.

You may have to add the 1st and 2nd scripts to both buttons to make them show/hide only when you want them to. And then you'll need a button to get you back to the menu from instructions. The 3rd to 5th scripts are the scripts for that third button:

when I  receive [end instructions v]
show

when I receive [instructions v]
hide

when gf clicked
hide

when I receive [instructions v]
show

when [back to menu sprite] clicked
broadcast [end instructions]
hide

What i just need help on is knowing what is Broadcast and its function and also When i recieve function, and why do they have to be together for script? if someone answer this that will help me a freakin ton and i wont probably be needing more help  smile

Offline

 

Board footer