Refactoring the player code to use for loops

PlayerController now uses for loops and arrays inorder to reduce amount
of copy pasted code. Also cleaned up the character movement code so that
behaviour is more consistent