Can't move diagonally

When following the code in the video, I was able to get movement but only left/right or up/down. When holding two movement keys (left and down for example) my pawn only moves left. How do I get it to add the horizontal and vertical movements when two movements are simultaneously held?

First you want to make sure that’s not a keyboard limitation. Keyboards have varying limits on the number of keys that can be used at any single time though almost certaintely it does two but who knows.

Second, I would think its default to allowing eg W and A keys at the same time (can’t remember off hand and not in Windows at the moment to check). If not, you would have to go in and allow both to work if both are pressed. In theory that would cause up and left to both fire making diagonal.

It would probably be along the lines of the course for key binding then adding in some listeners returning true and checking if both fire when both keys are pressed at same time. If they both do yet you don’t get diagonal then you would probably need to change the course yourself via code. If both don’t fire then that would be odd if its not a keyboard limitation.

Privacy & Terms