morphlingdev/Morphling — Issue #10: Movement Issues when Giving Two Opposite Direction Commands
Author: dr-hu
Created: 2012-01-17 02:04:12+00:00
State: open

Normally, movement works fine, but normally in games, when you press two opposite-facing arrows, movement will stop, and when releasing one key, the player will start moving the opposite way.

So instead of explicitly stating P_dx or P_dy, it should increment or decrement accordingly.

Eg. I press left arrow: P_dx--; P_dx == -1;
I press right arrow: P_dx++; P_dx == 0;
I release left arrow: P_dx++; P_dx == 1;
I release right arrow: P_dx--; P_dx == 0;

So as long as handle_event doesn't mess up, there shouldn't be a case where P_dx != 0 || P_dy != 0 when not pressing any keys.

Could you implement that?