Weapon pick up

Hello,

I am making a 2D platformer game in Unity. I want to make a weapon pick up system.

So the player is able to pick up weapons off the ground and swap that weapon with the currently equipped weapon.

But how can I do this the best? Switch the player sprite after he picks up the weapon?

Thank you in advance!

You can change the play’s sprite/animation set or make the weapons a child object of the character with its own graphics assets. Which one I think is best depends on a few things. Some questions come to mind:

-Are there just a couple weapons? 5 or 6? 100?

Hopefully you just make graphics for each individual weapon if you have a lot of them regardless of other factors, or your game’s size will be affected.

-Are you using puppet animation? Frame-by-frame animation?

If it’s puppet, make individual graphics and object for your weapons. The animation is based on object motion in the game space, and so making the weapon its own object as well is a logical extension. There are tons of examples of this, but Unepic is one of my favorites. If you aren’t using puppet, either strategy may still be viable depending on other factors.

-Regarding the character that uses the weapon: do they use each weapon the same way? Are there different sets of animations or attacks depending on the weapons? Does this differ depending on the weapon type?

Even if your characters are animated frame-by-frame, you could make a child object for the held weapon and make sprites for each different weapon that can be used, drawn so that they match the animations as appropriate. This is a good choice if all weapons are used the same way, like if the character always used the same attacks no matter which weapon is used. If some weapons can add maybe 1 unique attack, I would still use this method.

Something like Link to the Past is the kind of thing I’m talking about-- the 4 swords are all used identically. The graphic for the sword itself is simply changed while the character always swings them the same way.

If, however, you have a situation where the character uses totally or mostly different attack sets based on which unique weapon is being held, save some time and incorporate the weapons into the character sprites. You could still separate the graphics, but you won’t save space this time, and implementing them will be more challenging for no benefit. Megaman Zero comes to mind.

Going further, if there are different sets of attacks, but each set has more than one weapon that is used with it, I would still go with separating the weapon graphics from the character. La Mulana is a good example of this; even though some weapons are used the same way by the character, some aren’t, and so the graphics were separated. You could also do a hybrid of these methods to save space when you can, or to save time when it doesn’t save space.

These are just my suggestions, and there can be other reasons to separate the graphics or not.

@Hyblademin

Thank you so much for your answer!