How to manage a lot of items/powerups

Hi GD community,

I’ve been using gdevelop for about 3 years to make a game in my spare time, with the concept being - A roguelike rpg game that feels and behaves like a space shooter. That means randomized items which boost your skills as you play, a wide play area, and enemies that move in interesting and predictable patterns.

The items shoot additional projectiles from the player character. At the moment I have a separate event sheet with a large amount of if statements. Eg If variable HasFire = True and left mouse button is down, shoot fire.

I wonder if this may not be the most efficient way to code, considering I have plans for around 60 items. It seems like having 60 variable checks running at once will slow everything down.

Any suggestions on a better way to do this?

If external events are loaded at the beginning of a scene, is it worth creating an external event for each item? Will this make any difference?

Thanks all, what a great community this is and what a great piece of software

We’d have to see a snippet of your events.

Many things can be optimized using object groups and object variables. Projectiles can have object variables for speed and damage. Once added to the scene, the speed and damage can be retrieved from either the projectile or the weapon or maybe an array of structures. The same for weapons. They can have custom firing settings with the fire behavior for capacity or fire rate.

Once you notice events having similar events, there’s usually a way to merge at least part of the events into 1 event group. Look for the similarities and try to pull any data from variables or objects.

If you’re using fixed numbers they can usually be replaced with variables common to each object.

I agree with Keith.

Do you use evenements and objects groups?