Use the keys A and D to move left and right, hold W while walking to sprint, and click Q to attack. If you punch the punching bag, it will move and react, if you punch the blue ball, it turns red for a short amount of time.
This is a simple movement and combat system that you can copy the code of if you want to make a game with smooth movement and attacking systems. a