I'm working on a game a bit like "Super Smash Bros.", using C++ and SFML. I can't figure out a good way to program attacks.
First, I coded individual functions for each attack. The problem with this was that I needed three functions for each attack; one for dealing knock-back to other players, one for setting variables for the actual punch and one for checking for unique types of collision. This ends up being almost the same code for all the other attacks, and was also very messy for programming combos.
I then tried creating a class called Attack, and inherited classes like Punch and Kick. The problem with this was that I wasn't sure how to implement all of the methods in the Player class.
How do I program attacks and combos in a fighting game?