You cited games like "Jetpack Joyride" and "Geometry Dash" so I understand you are working on a 2D game with side scrolling view.
I assume the Y is up and X is right.
In Jetpack joyride:
- the camera is fixed
- the player only moves along Y-Axis
- you move transform the level and background to simulate that the player is moving, so the player speed is instead -enviromentSpeed. You can imagine your player on a treadmill.
In "Geometry Dash" the camera has an added grade of freedom as is smooth-following the player along Y-Axis.
You can refer to the included "Unity Script Package" from Standard Assets script present in Unity called CameraSmoothFollow2D.
Here a video:
The key part is the Update part where you update the Camera position to match the target position (generally the target is the main character and you want the same X and Y maintaining your current Z as Z is the distance between the player and the camera.). You generally don't want to instantaneously match his position but introduce some smoothing function or damp like this
Vector3 destination = target.transform.position;
destination.z = transform.position.z;
transform.position = Vector3.SmoothDamp(transform.position, destination, velocity, dampTime);
you put this in a script attached to your camera and velocity and dampTime are parameters to tune the camera behaviour