#How to make respawning power-ups?

8 messages · Page 1 of 1 (latest)

hollow crane
#

I want to know how to make power-ups respawn after being collected by the player.

Currently, the closest I got to making them do that exactly, is making the game check if the instance of that one power-up exists. if it does, do nothing. if it doesn't, spawn it after counting to 10 seconds. I did this in _process(), and it ended up spawning TONS of power-ups. How can I make this mechanic work properly?

#

here's the code for the power-up spawner

#

should i post it as text here?

sharp lantern
#

When you recover the powerup, you can simply start a timer and then when it timeout, you respawn the powerup.

ruby shadow
#

Your powerup could send a signal to its spawner when collected ; this signal enable a timer, when timer ends spawn_hp() is call.

hollow crane
#

fixed it - had to make the powerup a child of the spawner parent, then the child sends a signal to the parent, which starts a one-shot timer, and then when the timer hits 0, it spawns the powerup. i also had to make a bool which would reset everytime the spawner spawns a powerup so it wouldn't spawn like 100 powerups every frame

#

thank you, @ruby shadow !

#

and you too, @sharp lantern !