Um, can't you use boolean conditions to prevent that problem?
Code:
if (keyPressed(NUMPAD_7))
{
// exclusive or
if (keyPressed(NUMPAD_8) ^^ !keyPressed(NUMPAD_4))
{
vx = -sqrt(2);
vy = -sqrt(2);
}
else if (keyPressed(NUMPAD_8))
{
vx = 0;
vy = -1;
}
else if (keyPressed(NUMPAD_4))
{
vx = -1;
vy = 0;
}
}
...