How to code games for the PC and Xbox 360

After that, there's a call to the Vector2.Clamp() method. 'Clamping' a number means to ensure it falls within a specific range – in this example, we want to ensure that a player's velocity falls within the range -10.0f to 10.0f, otherwise they would be able to reach stupidly fast speeds.

Once the velocity has been clamped to acceptable levels, we add the player's velocity to their current position, which has the effect of moving the player as requested.