Browse Source

Paralllaaaaax

main
Tau-er\Bobbster 2 years ago
parent
commit
90222b70ce
6 changed files with 43 additions and 8 deletions
  1. BIN
      Assets/Art Assets/Textures/Environ/backdrop/clouds1.png
  2. BIN
      Assets/Art Assets/Textures/Environ/backdrop/clouds2.png
  3. BIN
      Assets/Art Assets/Textures/Environ/backdrop/clouds3.png
  4. BIN
      Assets/Scenes/Level 2.unity
  5. +24
    -0
      Assets/Scripts/Parallax.cs
  6. +11
    -0
      Assets/Scripts/Parallax.cs.meta

BIN
Assets/Art Assets/Textures/Environ/backdrop/clouds1.png (Stored with Git LFS) View File

size 3915

BIN
Assets/Art Assets/Textures/Environ/backdrop/clouds2.png (Stored with Git LFS) View File

size 2630

BIN
Assets/Art Assets/Textures/Environ/backdrop/clouds3.png (Stored with Git LFS) View File

size 3325

BIN
Assets/Scenes/Level 2.unity (Stored with Git LFS) View File

size 461758

+ 24
- 0
Assets/Scripts/Parallax.cs View File

@ -0,0 +1,24 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Parallax : MonoBehaviour
{
private float length, startpos;
public GameObject cam;
public float parallaxEffect;
void Start()
{
startpos = transform.position.x;
length = GetComponent<SpriteRenderer>().bounds.size.x;
}
// Update is called once per frame
void FixedUpdate()
{
float dist = (cam.transform.position.x * parallaxEffect);
transform.position = new Vector3(startpos + dist, transform.position.y, transform.position.z);
}
}

+ 11
- 0
Assets/Scripts/Parallax.cs.meta View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c27236bc6c2676e4bbfdb1265c9f7936
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

Loading…
Cancel
Save