diff options
Diffstat (limited to 'Assets/Scripts/ScrollingObject.cs')
-rw-r--r-- | Assets/Scripts/ScrollingObject.cs | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/Assets/Scripts/ScrollingObject.cs b/Assets/Scripts/ScrollingObject.cs new file mode 100644 index 0000000..e2b51e5 --- /dev/null +++ b/Assets/Scripts/ScrollingObject.cs @@ -0,0 +1,23 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class ScrollingObject : MonoBehaviour { + + private Rigidbody2D rb2d; + + // Use this for initialization + void Start () + { + rb2d = GetComponent<Rigidbody2D>(); + rb2d.velocity = new Vector2(GameControl.instance.scrollSpeed, 0); + } + + // Update is called once per frame + void Update () { + if (GameControl.instance.gameOver == true) + { + rb2d.velocity = Vector2.zero; + } + } +} |