Hello Guest

Author Topic: Dealing with sprite characters with varying size sprites  (Read 4952 times)

auticus

  • Newbie
  • *
  • Posts: 2
    • View Profile
Dealing with sprite characters with varying size sprites
« on: September 21, 2013, 05:28:56 pm »
I'm coding up a simple golden-axe type game and one of the issues that I have come across are that my animation clips use sprites that are not guaranteed to be the same dimensions.

For ex:  my idle animation may consist of 4 PNG files that have the same dimensions (lets say 128x128) but my attack animation goes to 280x180 due to a sword being swung around.

The issue is that when I trigger attack animation, it loads my animation just fine but because the sprite sizes differ, my visible x,y of the character changes.  In my case, he drops down and to the left noticeably when attacking, then resumes his animation.  This looks a bit jerky.

I'm assuming that somewhere I can pad this to offset for the difference, so when i run attack animation, I could realign the sprite to play the animation so that the apparent position of the character doesn't change.

The other alternative is to make all sprites the same size (the biggest) but that seems very wasteful (so idle, walk, and attack would all be 280x180)

Any suggestions?

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Dealing with sprite characters with varying size sprites
« Reply #1 on: September 21, 2013, 06:01:25 pm »
Padding is the recommended workflow. All empty space in the texture is automatically removed when building the atlas, so there isn't any waste in terms of the final result. That is how I've seen most artists work (using layers in photoshop, etc) - how do you create your sprite in the first place?

auticus

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: Dealing with sprite characters with varying size sprites
« Reply #2 on: September 21, 2013, 07:55:34 pm »
Well I'm not much of an artist which is what always holds my projects back.

For my prototype I found some arcade sprite sheets.  I am using that.

So essentially I grab the four cells that make up the idle, and made them all match each other.

For the attack sequence there are ten cells so I grabbed those, cut those up into their own files and matched them up with each other.

The problem is of course that the attack sequence cells are different size overall (280x180 vs the 128x128 of the idle). 

I'm not sure how layers in photoshop would help (but again I'm not an artist so my photoshop skills are limited to being able to cut up the sprite sheet and resize the images).  The only solution I could think of was to make the idle sprites also 280x180, that way say the left foot (my point of reference) is in the same general area.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Dealing with sprite characters with varying size sprites
« Reply #3 on: September 22, 2013, 11:30:33 am »
That is the easiest solution right now. Usually when painting these images, there will be some frame of reference. I can understand why extracted arcade spritesheets won't have any point of reference as they'd have all been trimmed/cropped before atlasing.