Sign in to follow this  

How to change clothes on character sprite

This topic is 1102 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm going to make a RPG game by Java ( and LibGDX ), but the problem is how to use item in inventory to character ?

I mean ... ex: I have an armor in inventory ( and nothing on item-wearing ), then I want to use this item by drag it on character, the sprite of character should be changed to show it. But how to do that ?

Share this post


Link to post
Share on other sites
Depends a lot on how your game is set up, if you want it to be like an RPG like skyrim or something where each piece of equipment gets shown you'd basically do the same thing done in a 3d game except in a 2d version. In a 3d game the armor is rendered with different mounting points relative to the character model to bascially make it look like they're actually wearing it.

In a 2d game you'd either have to have a sprite for each armor type you want sized to fit your character and one for each visible direction the sprite faces, then you'd simply draw it over the character. Not a very simple task, requires a lot of dinking around with the art and possibly writing some file data to specify mount points relative to the character sprite. For the artist the simplest way to do it would probably be to take the base character sprite, draw the armor over it then erase the body of the character and just save the equipment as a transparent image, or whatever you like. I won't go into pointless details like texture atlases and things.

You also have to deal with the problem of animations, for instance armor covering the arms or the torso may need its own animations to make it shift along with the character, that's why games like that will usually use a sort of basic one or two character sprites that act mannequins for the basic body shape and animations of any character.

Note because of the complexity this only applies to player characters, usually things like monsters will just have their equipment drawn right into their sprite for simplicity sake.

Share this post


Link to post
Share on other sites

Depends on your graphic setup.

 

You talk about Sprites, so I assume you choose 2D, and RPG, which normally implies an isometric viewpoint.

 

You just choose the hardest possible combination for creating visible clothing, sorry.... yes, you will have to create additional sprites for every animation phase of your characters in all possible facings, per clothing availalable. That is a LOT of additional overhead, and that is why usually, the isometric RPGs of old had no visible items on the characters.

 

Now, if you create a sidescroller, at least you can scratch off the facings as additional factor as you uasually have a single facing and mirror it for the other direction. For a sidescroller you might also get away with a bone-based animation system, which means you do not need to draw single animation phases, you can just attach the clothing to your bones (of course you might need to massage it here and there to look right).

 

Generally, if you are looking for an isometric viewpoint and want to go this much into detail, you should really consider going fully 3D. Lots of animation woes are less severe in 3D. Yes, 3D animations have something of an overhead, as you first need to rig your character and prepare all your objects for animation. But then you can just animate away, whithout redrawing your objects for every animation frame.

 

Of course this is assuming you do not go totally nuts on the details of your 3D objects and animations.

Share this post


Link to post
Share on other sites

This topic is 1102 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this