void OnTriggerEnter2D(Collider2D other) { if (other.CompareTag("Player")) { dedanimation script = dedguy.GetComponent <dedanimation>(); script.isded = 1; } }
// Update is called once per frame void Update() { pos = transform.position; gameObject.transform.position = pos; if (pos.x > 9) { dedanimation script = dedguy.GetComponent <dedanimation>(); script.isded = 1; } }