I am creating a game in 2D where my character walks to the right and when he hits a spring he flips and walks to the left. That works but the camera stays at the same position. I need to have more space while looking at the respective direction. When I look left, I can’t see much what will come on the left side. I hope that is understandable
However, here are my camera script and the script how I flip the character:
public class Camera : MonoBehaviour
{
public Transform target;
private Vector3 offset;
void Start()
{
offset = transform.position - target.position;
}
void Update()
{
transform.position = target.position + offset;
}
}
Now the flip section:
private void Flip()
{
facingRight = !facingRight;
playerRb.transform.localScale = new Vector3(playerRb.transform.localScale.x *-1, playerRb.transform.localScale.y, playerRb.transform.localScale.z);
}
I hope you can help me out ![]()
Kind regards