More accessible enums

Greetings,

In my game, I originally had a check for a “HurtsPlayer” group that checks if the thing that hurts the player is friendly or not. However, since I would like to introduce source dependent immunity frames and attack ownership to my game soon, I decided to deprecate it in favor of an enum.

Now, enums are only available in functions for some reason, but this is what I have:


Hurt player and Hurt enemy are self explanatory, Hurt both means it hurts both players and enemies, and Hurt neither means it’s harmless to everyone.

So, I have various code that changes the bullet’s property to “Hurts player” or “Hurts enemy” or etc. But when I put it into practice, nothing happened. My player wasn’t being hurt by the bullets?

I was scratching my head over this for a while, but then it finally hit me…
image
image

Case sensitivity…

It works now, but something like that is incredibly easy to miss. Annoyingly, there’s no dropdown option or anything to limit my options. I have to type these enums manually, which makes them prone to typos, and frankly defeats the purpose of using enums in the first place.

Therefore, I think it would benefit GDevelop greatly if enums could be used outside of functions, and this would streamline the process and prevent hiccups like this from happening.

What do you all think? Feedback is appreciated

1 Like

Could you not put the hurt properties into two bools instead?
Hurt_Player = true and Hurt_Enemy = true

Hurt both and Hurt neither can also be figured out from testing if both are true or false.