#stuck on how to implement hand animations for fps arms

1 messages · Page 1 of 1 (latest)

vivid steeple
#

i want to make a fps with multiple guns each with their own hand animations. i'm struggling on how i can implement it so i made this small chart (read left to right) with a potential solution. any feedback or pointers of how to do this efficiently are greatly appreciated

celest portal
#

That's definitely one way to do it and the logic seems good to me

#

Another way would be to apply what's called the "strategy pattern"

#

In the strategy pattern, your character doesn't have to know or care about anything specific to the gun they are using. The character just calls a "shoot" function and the gun itself takes care of handling any specific logic related to it (like firing one bullet or 3 spread bullets, or even calling specific animations to happen)

#

Up to you really

#

You could also just have a property in your gun class that hold the value for what animation the character should play

#

Lots of different ways you could approach this