You can achieve this a variety of ways. You can include control buttons that will only move him on X axis, or you can program in your game that the character has no Y jump, Y bounce, Y speed, etc.