I’ve been watching allot of videos teaching me about inheritance, interfaces, polymorphism etc, and I’m thinking about starting on a new project using what I’ve learned to make a bigger game than I’ve ever made before, but I don’t know what tool I should use to do what because there are endless ways to do basically anything, and I want to go the most practical route.
I thought about implementing inheritance by creating a humanoid class as the base class, containing all of the basics like pickUpItem() and takeDamage().
However, what if I want more classes, other than just humanoids, to be able to take damage?
Should I make one component that deals with health and spread it on everything I want to be able to take damage?
or should i make an interface like IDamagable that other classes that I want to be able take damage implement?
or should I go a bit extreme and make every single class that should take damage inherit from a class that contains a function that deals damage?
If I decide on using either a component or an interface should I remove the takeDamage() function from the humanoid class and make them use a component or an interface like all the other classes/objects do?