2D Game powerup script not working at all
I made a very simple power up scrip that is supposed to move the power up to a diffrent location and set a bool as positive after 5 seconds it should return the power up to its previus location and set the same bool as false, but it is not wotking at all.
private void OnTriggerEnter2D(Collider2D collision)
{
if (collision.gameObject.CompareTag("jump_boost"))
{
bpos = GameObject.Find(collision.gameObject.name).transform.position;
GameObject.Find(collision.gameObject.name).transform.position = GameObject.FindWithTag("RESET").transform.position;;
StartCoroutine(canmegajump());
GameObject.Find(collision.gameObject.name).transform.position = bpos;
}
}
IEnumerator canmegajump()
{
_megajump = true;
yield return new WaitForSeconds(5f);
_megajump = false;
}
Comment
Your answer
Follow this Question
Related Questions
2D Power up script not working 0 Answers
2D Power up script not working 0 Answers
Change Scene with Physics Raycasting 1 Answer
Player Can Not get off platform 1 Answer
How can I collect collider2Ds(Trigger) the player is in into an array 1 Answer