All pastes #2118309 Raw Edit

Untitled

public text v1 · immutable
#2118309 ·published 2012-02-17 02:55 UTC
rendered paste body
using UnityEngine;
using System.Collections;

public class Background : MonoBehaviour {
	
	public float speed;
	private float amtToMove; 
	private Vector3 rot;
	// Use this for initialization
	void Start () {
	    rot = new Vector3(0,1,0);
	
	}
	
	// Update is called once per frame
	void Update () {
		amtToMove=speed * Time.deltaTime;
		transform.Translate(Vector3.down * amtToMove,Space.World);
		transform.Rotate(rot*Time.deltaTime,Space.World);
		if(transform.rotation.y>=15)
			rot=new Vector3(0,-1,0);		
		if(transform.rotation.y<=-15)
            rot = new Vector3(0,1,0);
	}
}