Scriptum/Assets/Scripts/CamerFollow.cs
KrolMel 9b2ef41b89 Added map fragment
And camera movement
2022-03-24 22:50:10 +01:00

28 lines
612 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CamerFollow : MonoBehaviour
{
private Transform playerTransform;
// Start is called before the first frame update
void Start()
{
playerTransform = GameObject.FindGameObjectWithTag("Player").transform;
}
void LateUpdate()
{
// we store current camera's position here
Vector3 temp = transform.position;
temp.x = playerTransform.position.x;
temp.y = playerTransform.position.y;
transform.position = temp;
}
}