Menus

Game Editor comments and discussion.

Menus

Postby Turon » Sat Jan 22, 2011 4:57 pm

How do make a simple game menu? :roll:
Last edited by Turon on Tue Feb 01, 2011 7:16 am, edited 2 times in total.
Turon
 
Posts: 862
Joined: Sun Jan 24, 2010 5:23 pm
Score: 32 Give a positive score

Re: Menus

Postby Game A Gogo » Sat Jan 22, 2011 5:02 pm

You use what you know!

like having a filled region over a text actor to make a button, when clicking on a button you can either load the game or change the view position to change screen, make sure to have a back button :)
Programming games is an art,
    Respect it.
User avatar
Game A Gogo
 
Posts: 3466
Joined: Wed Jun 29, 2005 10:49 pm
Location: French Canada *laughs*
Score: 181 Give a positive score

Re: Menus

Postby Turon » Sat Jan 22, 2011 5:04 pm

I have tried many times......... I don't know the codes! :(
Turon
 
Posts: 862
Joined: Sun Jan 24, 2010 5:23 pm
Score: 32 Give a positive score

Re: Menus

Postby Hblade » Sat Jan 22, 2011 5:17 pm

To create a Menu:

Make a text actor with the list of selections, make the size 14. Now make a Canvas actor and put this code:
Code: Select all
erase(0, 189, 255, .60);

Place that code in Draw Actor, or Create Actor.
Make a variable called M_INDEX.

now this part is important, say you have like 6 options. Example:
    Items
    Status
    Equipment
    Journle
    Options
    Exit

M_INDEX's max number would be 5, because 0 counts ;) However many numbers you have, always remember that it's -1. So, for example if you have 24 selection items, then the max would be 23. You'll understand what I mean in the code.
Now make sevral events, KeyDown - Down
Code: Select all
if (M_INDEX<=5) {
    M_INDEX++;
    y+=16;
}
else if (M_INDEX==6) {
    M_INDEX=0;
    y-=(16*6);
}

Look carefully at the y-=(16*6);, because I can't remember if it's -1 for that too or not xD. Anyway, it should bounce the menu back to the top selection.

Now for KeyDown - Up
Code: Select all
if (M_INDEX>=0) {
    M_INDEX--;
    y-=16;
}
else if (M_INDEX==-1) {
    M_INDEX=5;
    y+=(16*6);
}


That should do the trick :D

Now all you gotta do for determining what option gets selected, is make a Key Down event for Enter, with something similar to this code.
KeyDown - Enter
Code: Select all
switch(M_INDEX) {
    case 0: //In our case, items
    //Your functions here
    break;
    case 1:
    //etc
    break;
}


Hope this helped :D
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 181 Give a positive score

Re: Menus

Postby Turon » Sat Jan 22, 2011 5:51 pm

Thank You Hblade :D
Turon
 
Posts: 862
Joined: Sun Jan 24, 2010 5:23 pm
Score: 32 Give a positive score

Re: Menus

Postby Hblade » Sat Jan 22, 2011 11:34 pm

Lol np man :)
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 181 Give a positive score

Re: Menus

Postby Turon » Sun Jan 23, 2011 7:13 am

the last code was a bit puzzling :?
Code: Select all
switch(M_INDEX) {
    case 0: //In our case, items
    //Your functions here
    break;
    case 1:
    //etc
    break;
}
can you explain it a bit more? :wink:
Turon
 
Posts: 862
Joined: Sun Jan 24, 2010 5:23 pm
Score: 32 Give a positive score

Re: Menus

Postby schnellboot » Sun Jan 23, 2011 8:12 am

ok so
case 0 is the first selection
you have to put there what it has to do when first thing is selected
for example if first is play and second is load then
Code: Select all
case 0:
view.x=300; //move the view to the game play area
view.y=400;
break; //you have to put this before every new case
case 1:
view.x=300;
view.y=400;
loadVars(blabla);


hope this helped
schnellboot
 
Posts: 819
Joined: Sat Mar 31, 2007 1:35 pm
Location: Germany
Score: 102 Give a positive score

Re: Menus

Postby Hblade » Sun Jan 23, 2011 6:40 pm

Thanks, schnellboot :D
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 181 Give a positive score

Re: Menus

Postby Turon » Thu Jan 27, 2011 6:31 am

schnellboot um do I put this in as well?:

move the view to the game play area

you have to put this before every new case
Turon
 
Posts: 862
Joined: Sun Jan 24, 2010 5:23 pm
Score: 32 Give a positive score

Re: Menus

Postby schnellboot » Thu Jan 27, 2011 7:24 am

you can but you don't have to
schnellboot
 
Posts: 819
Joined: Sat Mar 31, 2007 1:35 pm
Location: Germany
Score: 102 Give a positive score

Re: Menus

Postby Turon » Tue Feb 01, 2011 6:09 am

Is it for loading or playing game?
Turon
 
Posts: 862
Joined: Sun Jan 24, 2010 5:23 pm
Score: 32 Give a positive score

Re: Menus

Postby schnellboot » Tue Feb 01, 2011 6:17 am

for everything you only have to set it up ..
schnellboot
 
Posts: 819
Joined: Sat Mar 31, 2007 1:35 pm
Location: Germany
Score: 102 Give a positive score

Re: Menus

Postby Turon » Tue Feb 01, 2011 6:20 am

How must i edit it to play game? :D
Turon
 
Posts: 862
Joined: Sun Jan 24, 2010 5:23 pm
Score: 32 Give a positive score

Re: Menus

Postby schnellboot » Tue Feb 01, 2011 8:35 am

already explained that ..
schnellboot
 
Posts: 819
Joined: Sat Mar 31, 2007 1:35 pm
Location: Germany
Score: 102 Give a positive score

Next

Return to GE - General

Who is online

Users browsing this forum: No registered users and 1 guest