Example #1
0
	public Sprite blackSprite; //set images for background.

	void Start () {

		if (PlayerPrefs.GetInt ("controlHelp", 0) > 4) {
			waitTime = 2;
			//Destroy(this.gameObject);
		}

		if (PlayerPrefs.GetInt ("controlHelp", 0) > 20) {
			if(PlayerPrefs.GetInt("showHelp", 0) == 0){
				PlayerPrefs.SetInt("showHelp", 1);
			} else {
				Destroy(this.gameObject);
			}
		}

		scaleX = (float)(Screen.width) / origW; //your scale x
		StartCoroutine (coroutine1 ());

		spriteRenderer = GetComponent<SpriteRenderer>(); // we are accessing the SpriteRenderer that is attached to the Gameobject
		if (spriteRenderer.sprite == null) // if the sprite on spriteRenderer is null then
			spriteRenderer.sprite = blackSprite; // set the sprite to sprite1
		
		mainColor = new Color(mainColor.r, mainColor.g, mainColor.b, 0.5f);  
		//fullColor = gameObject.GetComponent<Renderer>().material.color;  
		gameObject.GetComponent<Renderer>().material.SetColor("_Color", mainColor);

		player = GameObject.FindWithTag ("Player");
		test = player.GetComponent<MainMovement>();
	}
 void Start()
 {
     movement = GetComponent <MainMovement>();
 }