VK_KEYS and GameStates...
Ok, Im trying to add a menu system to a game im working on right now. Right now, I have two states. GameRun and GameIntro. GameIntro is the Menu for the game. I want to be able for the user to hit escape while the menu system is up and it will exit the whole program, but, if they hit escape while they are in GameRun mode, then they goto the Intro. <- ya feel me???
Ok, I tried this for starters...
// Goto Menu System...
if (keys[VK_ESCAPE] && GameRun)
{
GameRun = false;
GameIntro = true;
}
// Quit Game...
else if (keys[VK_ESCAPE] && GameIntro)
{
GameIntro = false;
done = true;
}
And this doesnt work. Can someone please help me. Does DirectInput have some kinda special funtion or somthing that would look past this?
Thanks for all the help
>tHaPuTeR
i think you should try keys[VK_ESCAPE] & 0x80
and/or use DIK_ESCAPE instead
[edited by - adema on March 30, 2002 10:57:21 AM]
and/or use DIK_ESCAPE instead
[edited by - adema on March 30, 2002 10:57:21 AM]
you need a function that returns a true if key is clicked on, not if key is pressed.. in your code while in gamemode you press escape and game goes to menu but escape is still pressed so game exits..
for keyclick function you need another array for key states in lask fram and the you use somethin like :
if ( keypressed in this frame and not in last ) keyclick = true
There are more worlds than the one that you hold in your hand...
for keyclick function you need another array for key states in lask fram and the you use somethin like :
if ( keypressed in this frame and not in last ) keyclick = true
There are more worlds than the one that you hold in your hand...
You should never let your fears become the boundaries of your dreams.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement