(Borland C++ Free command line compiler, WinXP)
Ok, I made my engine its all working pritty well. But I have one problem. When I implimented jumping, I expected it to detect if the up and left arrows were down (Because of how its built). But I guess it only detects one or the other. So, when jumping, you will only go up or left even when holding the right arrow and up and with the left to.
(Include windows.h)
So, I tried:
Code:int IsArrowDown() {
if(GetAsyncKeyState(VK_UP)&SHRT_MAX)
return Up;
if(GetAsyncKeyState(VK_DOWN)&SHRT_MAX)
return Down;
if(GetAsyncKeyState(VK_LEFT)&SHRT_MAX)
return Left;
if(GetAsyncKeyState(VK_RIGHT)&SHRT_MAX)
return Right;
if(GetAsyncKeyState(VK_ESCAPE)&SHRT_MAX)
return Esc;
return 0;
}
Didint work. I dont see why it doesnt detect either initialy, but it their any way to detect both arrows?Code:int Check(int x) {
if(x==Right) {
MoveRight();
return 1;
}
if(x==Left) {
MoveLeft();
return 2;
}
if(x==Up && x==Right) {
MoveRight();
return 3;
}
if(x==Up && x==Left) {
MoveLeft();
return 4;
}
return 0;
}
[edit]
Forgot to include the arrow detecting code -,-.