I had a whole other response and sample code, but it only achieved the creation of ...something stupid.
How about, if two directions are ever pressed at the same time, unpress one of them.
EDIT: Altered the function to correct occasion presses of Left and Right while moving down, that would shift the character's x value.
It checks to see if the player if moving up or down. Then, if the player is moving left or right, it unpresses left or right, and restores the original X position the player had before he pressed left or right. The 'cd_player' variable needs to be set manually, though.
HookRetrace or HookTimer this function. Unfortunately, spazzing on left or right while moving up and down will cause the character's animation to flicker, but I don't know how to I can stop that.
int cd_player;
int cd_last_x;
void CorrectDiagonal() {
if (up || down) {
//Unpress left and right.
if (left || right) {
Unpress(7);
Unpress(8);
entity.x[cd_player] = cd_last_x;
}
}
else
{
cd_last_x = entity.x[cd_player];
}
}
}
HookRetrace or HookTimer that. In fact, maybe that should do it.