I have this program, when it starts, i am unable to press numbers. By pressing F this turns the numbers on.
However, the result is, i have to hold down F to use the numbers. I thought declaring ignition as true would stick after i had released F. And pressing G would turn it false again, but to no avail.
Im new to the C after using Java.
Code:
bool ignition;
ignition = false;
if (AdventureGame.keypressed[DIK_F] && (ignition == false))
ignition = true;
if (AdventureGame.keypressed[DIK_G] && (ignition == true))
ignition = false;
if (AdventureGame.keypressed[DIK_0] && (ignition == true))
GEARBOX.SetPositionX(-1),
GEARBOX1.SetPositionX(20),
GEARBOX2.SetPositionX(20),
GEARBOX3.SetPositionX(20),
GEARBOX4.SetPositionX(20),
GEARBOX5.SetPositionX(20),
GEARBOX6.SetPositionX(20);
if (AdventureGame.keypressed[DIK_1] && (ignition == true))
GEARBOX.SetPositionX(20),
GEARBOX1.SetPositionX(-1),
GEARBOX2.SetPositionX(20),
GEARBOX3.SetPositionX(20),
GEARBOX4.SetPositionX(20),
GEARBOX5.SetPositionX(20),
GEARBOX6.SetPositionX(20);
if (AdventureGame.keypressed[DIK_2] && (ignition == true))
GEARBOX.SetPositionX(20),
GEARBOX1.SetPositionX(20),
GEARBOX2.SetPositionX(-1),
GEARBOX3.SetPositionX(20),
GEARBOX4.SetPositionX(20),
GEARBOX5.SetPositionX(20),
GEARBOX6.SetPositionX(20);
if (AdventureGame.keypressed[DIK_3] && (ignition == true))
GEARBOX.SetPositionX(20),
GEARBOX1.SetPositionX(20),
GEARBOX2.SetPositionX(20),
GEARBOX3.SetPositionX(-1),
GEARBOX4.SetPositionX(20),
GEARBOX5.SetPositionX(20),
GEARBOX6.SetPositionX(20);
if (AdventureGame.keypressed[DIK_4] && (ignition == true))
GEARBOX.SetPositionX(20),
GEARBOX1.SetPositionX(20),
GEARBOX2.SetPositionX(20),
GEARBOX3.SetPositionX(20),
GEARBOX4.SetPositionX(-1),
GEARBOX5.SetPositionX(20),
GEARBOX6.SetPositionX(20);
if (AdventureGame.keypressed[DIK_5] && (ignition == true))
GEARBOX.SetPositionX(20),
GEARBOX1.SetPositionX(20),
GEARBOX2.SetPositionX(20),
GEARBOX3.SetPositionX(20),
GEARBOX4.SetPositionX(20),
GEARBOX5.SetPositionX(-1),
GEARBOX6.SetPositionX(20);
if (AdventureGame.keypressed[DIK_6] && (ignition == true))
GEARBOX.SetPositionX(20),
GEARBOX1.SetPositionX(20),
GEARBOX2.SetPositionX(20),
GEARBOX3.SetPositionX(20),
GEARBOX4.SetPositionX(20),
GEARBOX5.SetPositionX(20),
GEARBOX6.SetPositionX(-1);