Above, we have applied physics to a sprite but have not applied any constraints to those physics so our object that falls and applies physics actually tumbles outside of our game world and off screen which is not what we want. We want our physics object to react to the world and player interaction, however we want to keep it inside our level and prevent it from rotating on certain axis so that the sprite is always fully visible.
For our sprite, we can apply constraints from the Details panel in addition to applying physics.
Select the Sprite in your level that you want to apply physics to.
In the Details panel, click the Simulate Physics option under Physics.
Expand Constraints and choose the Lock Position (typically to the Y axis for side scrolling games).
While this will apply physics and lock it to only the Y axis, there are additional issues that may occur with just this setting.
Our sprite is now locked to the Y axis, however you can see that it can still rotate freely which may not be what we want.
Also in the Constraints section, choose a Lock Rotation (typically to the X axis for side scrolling games).
Now when physics is applied to the sprite its position is locked to the Y and its rotation is locked at the X.
You can also use the Mode option to constrain movement along a specified axis (in this case XZPlane to achieve the same effect).
Depending upon the type of 2D game you are making, varying settings can be used to restrict how physics are applied to your object.