i'm a little confused with the keypress thing.. this is how i write my code..

if(KEY_DOWN(VK_UP)){
// my statement ...

}

now what i want to achieve is, i want my statement to execute only once when i press up key. instead what happens is it keep executing till i release the key. i thought using bool might just help, but it didn't. i'm sure there's a way to get around this.. can someone help me please..

Most programs do their actions on key up. A way around this is to make a bool variable and make a KEY_UP if() statement.

For example:

bool upKey;
if( KEY_DOWN(VK_UP) && !upKey )
{
	upKey = true;
	//actions	
}

if( KEY_UP(VK_UP) )
{
	upKey = false;
}

I'm not sure if this is what you tried with a bool variable.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.