Hello everybody!
I am trying to create a small 2d action plattformer.
I want to create different armor peaces that my character can wear. Since I split my character in 3 parts (head, torso with arms, legs) each of those bodyparts can be armored differently.
At the moment I have a “hero.collection” with the 3 different bodyparts.
So lets say the player wants to equip a new helmet which is a game object that is in the project explorer at the moment. How do I replace the head object in the player collection with the equiped helmet object in runtime?
Do I need to use a factory file? (which I thought are used to create many instances of one specific object which is not the case here)
Or is there a better way (of course there is) to implement this armor feature?
If the change is only visual and it only entails changing of the current sprite animation for head, torso and legs then you can use play_animation to change animation at runtime.
Im using a custom animation system to be able to change the speed of an animation.
I want the armor peaces to be game objects because each armor peace should have a set of parameters like defense points, weight, etc.
So it would be great to be able to replace the current chest object with the armor object during runtime (e.g. when the player equips it)