aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'nGJ2019/Assets/Scripts')
-rw-r--r--nGJ2019/Assets/Scripts/LevelScrolling.cs66
1 files changed, 66 insertions, 0 deletions
diff --git a/nGJ2019/Assets/Scripts/LevelScrolling.cs b/nGJ2019/Assets/Scripts/LevelScrolling.cs
new file mode 100644
index 0000000..dd413f8
--- /dev/null
+++ b/nGJ2019/Assets/Scripts/LevelScrolling.cs
@@ -0,0 +1,66 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+public class LevelScrolling : MonoBehaviour
+{
+ public int updateRate = 1;
+ public Transform longcat;
+ public Transform background;
+
+ private Vector3 initialBgPos;
+ private float[] backgroundSize;
+
+ // Start is called before the first frame update
+ void Start()
+ {
+ ResizeBackground();
+ }
+
+ // Update is called once per frame
+ void Update()
+ {
+
+ }
+
+ void FixedUpdate()
+ {
+ MoveBackground();
+ MoveLongcat();
+ }
+
+ private void ResizeBackground()
+ {
+ var sr = background.GetComponent<SpriteRenderer>();
+ if (sr == null) return;
+
+ background.localScale = new Vector