Sprite Sheet Resulting on Unwanted Horizontal Motion

Non-platform specific questions.

Sprite Sheet Resulting on Unwanted Horizontal Motion

Postby bamby1983 » Fri Dec 21, 2012 5:23 am

These are probably noob questions and it's my first sprite sheet. I mashed up the following in GIMP, which is suppose to be the top view of a soldier walking.

Image

This worked fine at first and the animation played in Game Editor as though the soldier was walking on the same spot. I then adjusted the layer sizes and cropped the edges of the canvas a bit (what you see above is the latest version, i.e., after the canvas cropping). When I load this in Game Editor, the animation moves horizontally and then restarts at the initial position. It looks like Game Editor is assuming that each frame is horizontally displaces a bit further than the previous one, resulting in a horizontal motion.

I performed this cropping because I wanted to center the individual layers in GIMP so that each soldier image in the sprite could be rotated around the central axis (so it looked as though he was actually turning and not jumping to a different position). I now have 16 sprite sheets (each containing the above animation but with each soldier rotated by an additional 22.5 degrees). Can I combine all these into a single sprite sheet and use this instead? It would help reduce the number of files in my "data" folder. How would I let Game Editor know which range of pictures to play at a given point of time? I'm guessing something on the lines of animpos, but would I need to write code to loop through each range of animations each time? Or is there a simpler way?
bamby1983
 
Posts: 112
Joined: Tue Jul 31, 2012 11:36 pm
Score: 8 Give a positive score

Re: Sprite Sheet Resulting on Unwanted Horizontal Motion

Postby AliceXIII » Fri Dec 21, 2012 6:12 am

This worked fine at first and the animation played in Game Editor as though the soldier was walking on the same spot. I then adjusted the layer sizes and cropped the edges of the canvas a bit (what you see above is the latest version, i.e., after the canvas cropping). When I load this in Game Editor, the animation moves horizontally and then restarts at the initial position. It looks like Game Editor is assuming that each frame is horizontally displaces a bit further than the previous one, resulting in a horizontal motion.


in my experience this usually happens when images arent aligned correctly. imagine you have two 32 X 32 pixel frames setup one with an image originating at 2x,2y meanwhile frame two has the same image but originating from 2x,0y.

when something like this happens in animated images it creates a jumpy looking animation in GE.
"Taking a breath of fresh air."
User avatar
AliceXIII
 
Posts: 325
Joined: Fri Sep 17, 2010 2:36 am
Location: victoria, texas
Score: 37 Give a positive score

Re: Sprite Sheet Resulting on Unwanted Horizontal Motion

Postby skydereign » Fri Dec 21, 2012 9:55 am

What AliceXIII said is precisely the reason. You can't really crop the image, as it disrupts the alignment. Here is your image with the bounding boxes for the frames.
t6ulu9.png

If you want to crop it, you have to change the size of the bounding box for each frame. Think of it like a gif, where each next frame is simply above the current one. You can change the size of the image, but it won't change the alignment. This though only works if each frame is on top of the last. You can however crop the vertical component without messing up the alignment (since your animation strip is horizontal).
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: Sprite Sheet Resulting on Unwanted Horizontal Motion

Postby bamby1983 » Sat Dec 22, 2012 3:32 am

It worked after I adjusted the bounding box area as you said and made the spacing even on the sides as well. Thank you, I learnt something new today! :)
bamby1983
 
Posts: 112
Joined: Tue Jul 31, 2012 11:36 pm
Score: 8 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest

cron