started parallax
This commit is contained in:
27
Assets/ParallaxBackground.cs
Normal file
27
Assets/ParallaxBackground.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class ParallaxBackground : MonoBehaviour
|
||||
{
|
||||
public Camera camera;
|
||||
public SpriteRenderer renderer;
|
||||
public Vector2 scrollRate = Vector2.one * .4f;
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
//var currentPos =
|
||||
|
||||
//var offset = new Vector3(8f, -7.5f, 0f);
|
||||
|
||||
//renderer.transform.position = camera.transform.position + ((camera.transform.position * new Vector3(scrollRate.x, scrollRate.y, 0f)) - offset);
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user