Multiple Selection Enum?

Hey Guess,

For my game I have a class with an Enum in it, Depending on what enum is selected it gives the weapon different attributes. What I am trying to figure out how to do however is allow the weapon to have multiple attributes…

say one weapon has a fire and a water attribute, normally I would set it up like

enum WeaponAtri {
Water,
Fire,
Earth
}

and the weapon would have one of those three, what If I wanted it to have two?

would it be is simple as ItemClass.weaponAtri.Water,Fire

Ditch the enum and use a set of bools instead. So you’d have water = true, fire = false, etc.

–Eric

Your weapon class could have an array of WeaponAtri. Although, since they are simple toggles, using bools as Eric said may be simpler in the long run anyway.

hmm, so if you have a lot of abilitys i guess that could get really long creating an item each time, but i guess it would be better

hmm maybe ill just bite the bullet and have a ton of bools

There’s no one right way. If you like enums and would rather compare against that, then by all means, do so. I find that when it comes to conforming to “best practices” vs doing something that makes sense to you, you should almost always go with the second option. Unless you’re sharing code with a team and other people have to understand what you’re doing, the most important thing is making progress and eventually finishing your game, right?