Double shoot

Hi everybody! I’ve got a question… i’m building a shooter, but i have no idea of how to realize power ups. During the function on trigger enter 2d, i would like to activate the double shoot and i don’t know how to write the code. Could you help me please?

make bool PowerUp;
//lifetime of PowerUps, if you need
public float time;

switch it to true in trigger funktion.
OnTriggerEnter2D (Collider2D other) {
if (other.gameObject.tag == “TagForUP”) {
PowerUp = true;
//here you can make timer to disable PowerUp
Invoke (“DisablePowerUp”, time);}}

//if you have time
void DisablePowerUp () {
PowerUp = false;}

then check boolean, if you call your shooting

if (PowerUp) {then double shoot}
else {just shoot}.

you can make prefab, one for normal shoot, second for double shoot.

1 Like

Thank you so much .How it works?
Sorry I’m terrible in scripting