Discuss Scratch

manwithmanykids
Scratcher
67 posts

Help With user interface menus etc

So I am at the point where I need to incorporate a User interface into my Game design. In my previous Game I had a 6 buttons across the bottom of the screen. This worked for this game. Now I am looking at creating a full menuing system. Can anyone give me a couple of examples of how to handle this. I plan on have menus, and submenus and possibly sub sub menus etc.

I have written menus in other languages where I have full control over the interface and this is blocking me from seeing how to do this here, Any suggestions would be appreciated

Thank you
mwiedmann
Scratcher
100+ posts

Help With user interface menus etc


You can create a sprite for each menu option, then have the sprites listen for broadcasts telling them when to show or hide. Each menu (sub menu, whatever) will listen for 2 events:
1. their menu name, example “when I receive menu_4”
2. a global menu hide “when I receive menu_hide”

menu_4 would make the sprite show, the other obviously hides it.

Inside the menu_4 event it would broadcast another menu_# event (preceded by a menu_hide of course), or it would broadcast something more significant like start_game. The stage can also listen for these event and make appropriate background changes.

———–

Another way is to make larger sprites that have all the options for that menu on it. You then make each menu option a different color so you can use “when touching color” test to see what menu option was clicked.
manwithmanykids
Scratcher
67 posts

Help With user interface menus etc

mwiedmann wrote:

You can create a sprite for each menu option, then have the sprites listen for broadcasts telling them when to show or hide. Each menu (sub menu, whatever) will listen for 2 events:
1. their menu name, example “when I receive menu_4”
2. a global menu hide “when I receive menu_hide”

menu_4 would make the sprite show, the other obviously hides it.

Inside the menu_4 event it would broadcast another menu_# event (preceded by a menu_hide of course), or it would broadcast something more significant like start_game. The stage can also listen for these event and make appropriate background changes.

———–

Another way is to make larger sprites that have all the options for that menu on it. You then make each menu option a different color so you can use “when touching color” test to see what menu option was clicked.


Thanks for the suggestions. Do you have an example where these ideas are used that I could look at?
mwiedmann
Scratcher
100+ posts

Help With user interface menus etc


Here is the basic idea.

Simple Menu Demo

It works fine, but I always hate creating a bunch of sprites. There is probably a way you can do this with 1 sprite, some clones, and a bunch of different costumes for the different menu options. Hmm, that could make a fun “how to” project. I may work on it, but this works fine for basic menus.
manwithmanykids
Scratcher
67 posts

Help With user interface menus etc

I am currently working on Something. I Will post it if it works (It works in my head lol)

manwithmanykids
Scratcher
67 posts

Help With user interface menus etc

And a Menu System is Concieved and Born

http://scratch.mit.edu/projects/10627607/

Zparx
Scratcher
500+ posts

Help With user interface menus etc

manwithmanykids wrote:

I am currently working on Something. I Will post it if it works (It works in my head lol)



A perfect example of what you're trying to do is incorporated into my game, Toasty's Adventure 2.0! which you can click here to see (You'll have to play through the tutorial and then die to see it)

What I've done is set a variable called “screen” to values based on what page I want to show. For example, when you go to the “Gadgets” section, all of the sprites that are for that page only show up because they're waiting for the variable to equal 3, and if it doesn't equal that, it hides those sprites and they all wait again. All of the other sprites are either waiting for the variable to equal 4 or 5 until they show. This eliminates the use of broadcasts and is a much more reliable method. It also shortens the amount of scripts you use. Let me know if you need more of an explanation! Hope this helped.

- Z

Last edited by Zparx (June 4, 2013 18:28:07)

mwiedmann
Scratcher
100+ posts

Help With user interface menus etc

I've created a method for menus with as many sub-menus as you want and it only uses 1 sprite. Just draw your menu item images, add them to the costume list, and add a row to the menu list. That's it!

Menu How To

It's really easy to use. You can drop it right into your game.
flarmingalarming
New Scratcher
1 post

Help With user interface menus etc

I can't really seem to figure out how to fix my problem with my apple game. So far I'm trying to make a shop that's open and closeable. I've made it openable, but not closeable. Help please!

Powered by DjangoBB