This is a tutorial for platformers. I would highly recommend full screen so you can see the code. 1 for player physics and 2 for enemies.