I planned to make a weapon class which is should be instanced by the type of weapon.
It has a dictionary with the weapon names and those attributes. One of attributes is its sprite texture. So I managed to instance an appropriate type weapon in runtime, but i have trouble to set its collision shape.
Is there any way to set the shape from a texture mask? So I dream somethink like this:
for weapon1 collisionshape2d.setshape("res://collisionShapeMask1.png") and for weapon2 collisionshape2d.setshape("res://collisionShapeMask2.png")
Or other idea is I create a lot of collisionshape2d, set its form that reflect the appropriate weapon form and enable/disable in runtime. However it does not seem to nice.
Or should I go with the rookie solution? Make a scene for all weapons and turn enable(show)/disable(hide) those i would like to use?
thank you very much