// Update is called once per frame void Update() { //renderer var deltaspeed = pspeed * Time.deltaTime * 11; //Debug.Log (deltaspeed); gameObject.transform.position += new Vector3(0, -deltaspeed); if (gameObject.transform.position.y <= -cheight / 2) { Destroy(gameObject); bg.GetComponent <BG3> ().asd = true; } }
void Start() { bg = GameObject.Find("Stage3BG").GetComponent <BG3> (); pspeed = bg.GetComponent <BG3> ().speed; cheight = 2 * Camera.main.orthographicSize; cwidth = cheight * Camera.main.aspect; rend = GetComponent <SpriteRenderer> (); var tex = textures [Random.Range(0, textures.Length)]; if (tex != null) { rend.sprite = tex; } }