Best design practices for powerups

Hi everybody. I’m developing a sort of space shooting with free movement and multiplayer instead of enemies.
I’ve started implementing the powerup feature and I am unsure on what kind of design pattern I should use for them. Is there a “best practice” kind of design for power ups?

Thanks in advance.

This is quite a broad request. Therefore, the simple answer is “No, there is not a single best practice specifically for this”. :slight_smile:

What may be slightly more helpful as an aswer, however, may be to have a go at following this tutorial. See how you get on with that and hopefully find some useful pointers / ideas.

Thank you so much for your answer! I’ll get to the tutorial as soon as I can. I’m so sorry, I didn’t think about giving more information about the game. So let me fix it :slight_smile:

To begin with is in 2D and I’ve already implemented a primitive way of doing Powerups:
my plan is to spawn them randomly on the map one (or two top) at the time and give the players the chance to get them in a certain amount of time before they de-spawn. Once a Powerup collides with one of the players it disappears and gives its bonus to the player that got it.

The way I have implemented it up till now is to have the powerups call some public methods of the Ship class (abstract for all the different kinds of ships I want to make) through the instance of the collided object passed to the method OnTiggerEnter2D().

Hi LaMa21, that certainly sounds to be a reasonable enough approach. I’m sure you could get that working quite nicely. :slight_smile: