This site requires JavaScript, please enable it in your browser!
Greenfoot back
SayMyName
SayMyName wrote ...

2012/6/3

Menu Screen/ Shop screen

SayMyName SayMyName

2012/6/3

#
Hello guys, Can someone link me to a tutorial of how to make a menu screen or can you explain the logic behind it. I don't quite get it. What kind of class do I need or objects ? How will I call it and if I want to use pictures instead of drawing the menu screen how will I do it? Also is a shop screen the same concept? Thanks
Sidstar Sidstar

2012/6/3

#
Same I want to know
danpost danpost

2012/6/3

#
You will need two types of objects; one for the background of the menu (which could have a title, or instruction on menu use), and one for the different options of the menu (which could be in the form of buttons, icons, zones, etc.). The best object to use for in-game menus or shop screens is a new world object ('MenuWorld' or 'ShopWorld'). The advantage of using 'Greenfoot.setWorld(new MenuWorld(this))' to produce a new world is that the old world can be effectively 'paused' during the time the Menu or Shop worlds are up and running. The 'this' sent to the Menu or Shop worlds is saved in a World variable (otherWorld) until such time as you exit those world, where you imploy 'setWorld(otherWorld);', which immediately resumes where it left off. You will need methods in the Main world that the Menu and Shop worlds can call to incorporate any changes due to the selections made within those worlds. For the Menu world, you only need one class of object (one that when clicked on, calls a method in the 'otherWorld' to inform it of the specific click). The objects, like I said previously, can have whatever image you want them to have (icons, buttons, whatever). Each one will have a specific String or int value attached to them to help keep track of what is what; and so you have something specific to report back to the 'otherWorld' with. A Shop world can be very similar to the Menu world, aside from the added complexity of dealing with the monies part.
copyrightkid copyrightkid

2012/6/4

#
Can you give an example? Cheers
SayMyName SayMyName

2012/6/4

#
danpost wrote...
You will need two types of objects; one for the background of the menu (which could have a title, or instruction on menu use), and one for the different options of the menu (which could be in the form of buttons, icons, zones, etc.). The best object to use for in-game menus or shop screens is a new world object ('MenuWorld' or 'ShopWorld'). The advantage of using 'Greenfoot.setWorld(new MenuWorld(this))' to produce a new world is that the old world can be effectively 'paused' during the time the Menu or Shop worlds are up and running. The 'this' sent to the Menu or Shop worlds is saved in a World variable (otherWorld) until such time as you exit those world, where you imploy 'setWorld(otherWorld);', which immediately resumes where it left off. You will need methods in the Main world that the Menu and Shop worlds can call to incorporate any changes due to the selections made within those worlds. For the Menu world, you only need one class of object (one that when clicked on, calls a method in the 'otherWorld' to inform it of the specific click). The objects, like I said previously, can have whatever image you want them to have (icons, buttons, whatever). Each one will have a specific String or int value attached to them to help keep track of what is what; and so you have something specific to report back to the 'otherWorld' with. A Shop world can be very similar to the Menu world, aside from the added complexity of dealing with the monies part.
does this mean i make MenuWorld/ShopWorld a sub class of World or Actor?
You need to login to post a reply.