-
-
Save kihira/60ac04db531b88556549 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public float scrollSpeed = 0; | |
public Vector3 direction; | |
private Vector3 startPos; | |
// Use this for initialization | |
void Start () { | |
startPos = transform.position; | |
} | |
// Update is called once per frame | |
void Update () { | |
float newPos = Mathf.Repeat(Time.time * scrollSpeed, GetComponent<SpriteRenderer>().bounds.size.y); | |
transform.position = startPos + direction * newPos; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment