refactored code into a platformer character controller