First of all, I'm aware that multiple inheritance is not allowed, and for good reasons too! But I'm trying to find the Godot way around it to avoid having duplicate code.
Here's my situation:
- I have a turret class that shoots targets entering its area
- I also have a base enemy class, what it does is not relevant
- I have a tank class which extends enemy
The thing is, the tank has the same shooting mechanics as the turret, in fact they share some nodes and pieces of code. Problem is tank needs to extend enemy, so I can't really reuse the turret code and I have to duplicate it and place it in the tank script.
Is there a way to avoid duplicating the shooting code? Ideally I would have the shooting mechanics written in a script and have both tank and turret use it.