Page 1 of 1
how do you create a "toggle" button
Posted:
Fri Jan 04, 2008 1:14 pm
by stevenp
how do you create a "toggle" button? like press the button once it goes to a menu, press the button again, it exits the menu?
i have the menu already but the way im using it is, key down ( go to menu) key up go back to normal position screen, and that gets annoying
Re: how do you create a "toggle" button
Posted:
Fri Jan 04, 2008 1:26 pm
by Bee-Ant
Before i explain it, do you know how to make timers well???
Re: how do you create a "toggle" button
Posted:
Fri Jan 04, 2008 1:44 pm
by stevenp
ya my game is 80% collision events and timers lol
Re: how do you create a "toggle" button
Posted:
Fri Jan 04, 2008 1:56 pm
by Bee-Ant
OK...
Well, first make a variable called "menu",integer
Do you mean do 2 things or more in 1 button right?
Keydown>Button>
- Code: Select all
if(menu==0)
{
//go to menu2 from menu1
CreateTimer("Menu2Set", 50 ms);
}
Timer>Menu2Set>
- Code: Select all
menu=1;
Keydown>Button>
- Code: Select all
if(menu==1)
{
//back to menu1
CreateTimer("Menu1Set", 50 ms);
}
Timer>Menu1Set>
- Code: Select all
menu=0;
Re: how do you create a "toggle" button
Posted:
Sat Jan 05, 2008 12:44 am
by stevenp
i meant going from the game screen, to the menu, and back, all with only 1 button, like a toggle, on / off , but il try that and see if it works
Re: how do you create a "toggle" button
Posted:
Sat Jan 05, 2008 1:12 am
by Game A Gogo
depends how your translation is controlled, if it's controlled by a variable, use this:
- Code: Select all
Var=!Var;
Re: how do you create a "toggle" button
Posted:
Sat Jan 05, 2008 8:58 am
by Bee-Ant
mojo domo wrote:i meant going from the game screen, to the menu, and back, all with only 1 button, like a toggle, on / off , but il try that and see if it works
My code would be like that...
Re: how do you create a "toggle" button
Posted:
Sun Jul 13, 2008 10:15 pm
by pdude1
do you know how to toggle stuff like weopons so i can make my guy switch from a machine gun to shotgun and stuff like that?