May-11-2021, 02:32 PM
So let's say I have 10 'roles' and 10 'races', I'd like to make each of them into a class.
Every character (player, npc, whatever) has a role and also has a race.
How can I make an object inherit functions and variables from two classes, while also making it possible to create connections between the classes? (As in, let's say one race changes the way something in role works). Obviously I don't want to create 100 subclasses that inherit from each role and each race.
I know one solution is to just make every object (npc, player) a tuple (or a list) with one element being a role and the other a race, but I was wondering if there is an alternative?
If not, I can do with it being a tuple. In that case, are there any things I should look out for / remember about?
Every character (player, npc, whatever) has a role and also has a race.
How can I make an object inherit functions and variables from two classes, while also making it possible to create connections between the classes? (As in, let's say one race changes the way something in role works). Obviously I don't want to create 100 subclasses that inherit from each role and each race.
I know one solution is to just make every object (npc, player) a tuple (or a list) with one element being a role and the other a race, but I was wondering if there is an alternative?
If not, I can do with it being a tuple. In that case, are there any things I should look out for / remember about?