Character Sprites with Separate Clothing
#1
Posted 11 February 2012 - 04:12 AM
This may get a bit confusing as I'm not sure how to word my question quickly and clearly. In my current game (a bog-standard RPG with North/South/East/West movement - think Pokemon), I've come across a problem. I want to be able to equip my character with clothing, and have that clothing displayed on the character in-game, but I'd rather not have to create an entire sprite sheet of animations for my character for every combination of gear he's going to pick up. Instead I'd like to have the clothing as separate sprites that can be drawn over the character template, staying with him as he moves. All up I'd like to be able to have options for head, torso, legs and feet. I also need the clothes to animate with my character, meaning that at every step they need to be at the same sub-image as the character sprite.
Now we get to my issue. I don't know how to go about setting all of this this up. Is there a DnD method for this, or will I need to dip into GML?
Any and all advice would be greatly appreciated!
Thanks in advance,
ShadowSketch
NOTE: After writing this all out I get the feeling this might be a somewhat common question, unfortunately as I said I didn't know how to word it well, especially not in a form that would garner me many search results. My apologies.
#2
Posted 11 February 2012 - 04:34 AM
Well this seems to be a multi layered question. First off, you need to use a variable, with 0 being your normal guy, 1 being your first set of clothes, etc. Anyway, you odn't need to use a sprite sheet, you can just use multiple images seperate, the easiest way to do this is to set the subimage to a variable that you can change when you get the clothes. If you use multiple sprites, that will be very tedious to code..Hey everyone,
This may get a bit confusing as I'm not sure how to word my question quickly and clearly. In my current game (a bog-standard RPG with North/South/East/West movement - think Pokemon), I've come across a problem. I want to be able to equip my character with clothing, and have that clothing displayed on the character in-game, but I'd rather not have to create an entire sprite sheet of animations for my character for every combination of gear he's going to pick up. Instead I'd like to have the clothing as separate sprites that can be drawn over the character template, staying with him as he moves. All up I'd like to be able to have options for head, torso, legs and feet. I also need the clothes to animate with my character, meaning that at every step they need to be at the same sub-image as the character sprite.
Now we get to my issue. I don't know how to go about setting all of this this up. Is there a DnD method for this, or will I need to dip into GML?
Any and all advice would be greatly appreciated!
Thanks in advance,
ShadowSketch
NOTE: After writing this all out I get the feeling this might be a somewhat common question, unfortunately as I said I didn't know how to word it well, especially not in a form that would garner me many search results. My apologies.
#3
Posted 11 February 2012 - 04:51 AM
Well this seems to be a multi layered question. First off, you need to use a variable, with 0 being your normal guy, 1 being your first set of clothes, etc. Anyway, you odn't need to use a sprite sheet, you can just use multiple images seperate, the easiest way to do this is to set the subimage to a variable that you can change when you get the clothes. If you use multiple sprites, that will be very tedious to code..
Thanks for the quick reply!
I'm not 100% sure what you're saying here. My understanding is that I should have a single sprite with multiple sub-images, and the sub-image changes when I change clothes, correct? The problem with that method would be that I wouldn't be able to have an animated character since the sub-images would be storing different outfits?
I've been mucking around with some stuff and I'm in the middle of testing a method. I've got my character template sprite (just a little naked figure with a walking animation) and a shirt sprite that lines up with my character and has been created to be obscured in the right places, etc. so that when it's drawn over the top of the character sprite it appears as if he's wearing it. I've created an object that only has a single event (Draw) and two actions within that event ("at relative position (0,0) draw image -1 of sprite character_template", "at relative position (0,0) draw image -1 of sprite shirt_test") (actions written as they appear when moused over). When I enter my game, my character appears and he's wearing the shirt... but his animation is WAY too fast. How can I slow it down?
EDIT: Okay, I'm silly, I just needed to set the image_speed variable. I think that just about wraps this thread up...
Edited by ShadowSketch, 11 February 2012 - 04:56 AM.
#4
Posted 11 February 2012 - 04:55 AM
Well, you could make each shirt have an animation, but i guess the way you're doing it would actually be better if it works. If you want to slow down the walking animation you can go into his create event and set image_speed to a low (under 1) value, and keep experimenting until it looks good.
Well this seems to be a multi layered question. First off, you need to use a variable, with 0 being your normal guy, 1 being your first set of clothes, etc. Anyway, you odn't need to use a sprite sheet, you can just use multiple images seperate, the easiest way to do this is to set the subimage to a variable that you can change when you get the clothes. If you use multiple sprites, that will be very tedious to code..
Thanks for the quick reply!
I'm not 100% sure what you're saying here. My understanding is that I should have a single sprite with multiple sub-images, and the sub-image changes when I change clothes, correct? The problem with that method would be that I wouldn't be able to have an animated character since the sub-images would be storing different outfits?
I've been mucking around with some stuff and I'm in the middle of testing a method. I've got my character template sprite (just a little naked figure with a walking animation) and a shirt sprite that lines up with my character and has been created to be obscured in the right places, etc. so that when it's drawn over the top of the character sprite it appears as if he's wearing it. I've created an object that only has a single event (Draw) and two actions within that event ("at relative position (0,0) draw image -1 of sprite character_template", "at relative position (0,0) draw image -1 of sprite shirt_test") (actions written as they appear when moused over). When I enter my game, my character appears and he's wearing the shirt... but his animation is WAY too fast. How can I slow it down?
#5
Posted 11 February 2012 - 04:58 AM
Well, you could make each shirt have an animation, but i guess the way you're doing it would actually be better if it works. If you want to slow down the walking animation you can go into his create event and set image_speed to a low (under 1) value, and keep experimenting until it looks good.
Yup, works like a charm! It'll take a bit of fiddling once I implement character movement but it's working so far! Thankyou!!!
#6
Posted 11 February 2012 - 05:00 AM
Good luck with your game, and if you need any more help, we'll be here
Well, you could make each shirt have an animation, but i guess the way you're doing it would actually be better if it works. If you want to slow down the walking animation you can go into his create event and set image_speed to a low (under 1) value, and keep experimenting until it looks good.
Yup, works like a charm! It'll take a bit of fiddling once I implement character movement but it's working so far! Thankyou!!!
#7
Posted 11 February 2012 - 05:21 AM
It seems that a lot of the questions on the forums could be answered by the control object.
What I did was create a mancontrol object and a Plypos object. There are two objects, like let's say manbody, and then let's say planebody. When switching between the two, I keep track of the manobject in the mancontrol by basically saying:
plypos.x = manbody.x
plypos.y = manbody.y
Therefore when I do the if button = "whatever" then I just make sure that the view follows plypos, and then change the mancontrol to planecontrol. Then spawn the planebody at plypos, and destroy the manbody...
Now how does this relate to this topic??? Well, because plypos.x/y is exactly where the manbody is, then you can place the clothes_blue object at plypos.x/y and it will be on that body so long as it's depth/layer is more positive than the manbody.
In review:
OBJECTS:
plypos : This is the place the player is at all times.
mancontrol : this is the controls of the manbody
planecntrol : this is the controls of the planebody
manbody : this is the manbody and basically does absolutely nothing but look good, and detect out of room conditions.
planebody : this is the same as manbody
bluesuit : this is the same as the manbody and is either controlled by mancontrols or it's own controls if you want.
Score : An istance that can be turned invisible if you don't want to see the score.
Now finally, the Score is usually 100% on the screen at all times, so put overall controls in this Score_object, including deactivating things, plypos reminders in a step, and of course the score drawing on the screen.
Edited by MrCaprica, 11 February 2012 - 05:22 AM.
#8
Posted 11 February 2012 - 05:42 AM
I had the same issue when making my character actually holding the weapons that he has equipped.
It seems that a lot of the questions on the forums could be answered by the control object.
What I did was create a mancontrol object and a Plypos object. There are two objects, like let's say manbody, and then let's say planebody. When switching between the two, I keep track of the manobject in the mancontrol by basically saying:
plypos.x = manbody.x
plypos.y = manbody.y
Therefore when I do the if button = "whatever" then I just make sure that the view follows plypos, and then change the mancontrol to planecontrol. Then spawn the planebody at plypos, and destroy the manbody...
Now how does this relate to this topic??? Well, because plypos.x/y is exactly where the manbody is, then you can place the clothes_blue object at plypos.x/y and it will be on that body so long as it's depth/layer is more positive than the manbody.
In review:
OBJECTS:
plypos : This is the place the player is at all times.
mancontrol : this is the controls of the manbody
planecntrol : this is the controls of the planebody
manbody : this is the manbody and basically does absolutely nothing but look good, and detect out of room conditions.
planebody : this is the same as manbody
bluesuit : this is the same as the manbody and is either controlled by mancontrols or it's own controls if you want.
Score : An istance that can be turned invisible if you don't want to see the score.
Now finally, the Score is usually 100% on the screen at all times, so put overall controls in this Score_object, including deactivating things, plypos reminders in a step, and of course the score drawing on the screen.
Woah, that's a much more complex way of doing it, I don't know if I quite follow what you're doing there!
Anyway, I've come across a new problem. I have my character animations for up, right, down and left. I've got keyboard events (NOTE: NOT KEY PRESS) for the arrows keys with actions that set a variable "facing" to 0, 1, 2 or 3 for up, right, down or left respectively, as well as setting image_speed to 0.2. I have key release actions that set both image_speed and image_index to 0. In my draw step it checks for each of the 4 possible values for "facing" and draws the correct sprite. The desired out come is that pressing an arrow key will cause the character to "walk" in that direction (not actually moving yet, just playing the correct animation), while releasing the key will reset back to the "standing" sub-image but maintain the direction the character is facing.
My issue is that pressing more than one arrow key at once causes a few problems. The first problem is that the keys seem to have a priority order. In order from lowest to highest, it goes Left > Up > Down > Right. So if I'm holding down the left arrow key and then hold down any other arrow key at the same time, the left arrow key actions is ignored. The same happens for the up key, but only with the right and down keys. The right key is only over-written by the down key, and the down key takes precedence over everything. What's going on here? An interesting fact is that holding down both the left and up keys cause the character to play his walking animation for up, and it takes precedence over a down key press. Pretty odd behaviour.
The other problem is after holding two keys and releasing one, the character pauses his animation for a split second and then keeps going. I believe this is because in my Key release events I'm setting the animation back to sub-image 1. How can I fix this?
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users











