I have the following code in my winproc:
case WM_KEYUP:
{
if (VK_LEFT == _wparam)
{
if (HeroSprite->GetDirection() == WALK_LEFT)
{
HeroSprite->StopWalking();
}
}
if (VK_RIGHT == _wparam)
{
if (HeroSprite->GetDirection() == WALK_RIGHT)
{
HeroSprite->StopWalking();
}
}
if (VK_SPACE == _wparam)
{
if (!((GetAsyncKeyState(VK_RIGHT) & 0x8000) == 0x8000) &&
!((GetAsyncKeyState(VK_LEFT) & 0x8000) == 0x8000))
{
if (HeroSprite->GetWalkingState())
{
HeroSprite->StopWalking();
}
}
}
}
break;
What I want to happen, is if either of the movement keys (left and right arrow keys), are released at the same time the attack key(space bar) is hit, for the character to stop moving.
Any advice or suggestions on how I could possibly get this to happen would be great.