Page 1 of 1

Character Animation Offsets

Posted: Sun Oct 23, 2022 11:03 am
by Niran
So i've started working on adding my own character, everything so far went rather smoothly but now that i'm working with the gun-running animations which are an exception to the normal 8 directional predefined sprites i can't seem to line up the sprites correctly.

No matter what i do, when i line it up perfectly while running to the right, it will have a massive offset to the right while running to the left, generally speaking the left animations all seem to not properly shift no matter what i do, they never line up.

Looking through the official documentation for animations and prototypes (which is rather non-existent and very minimal sadly) i can't seem to find anything that could help. The game itself (looking at how the base character is done) doesn't give any hints either. It's already strange that the gun running animations use

Code: Select all

direction_count = 18
which according to the official documentation is not even a thing, these 18 directions don't include the left side, they are simply mirrored from the right animation sprites, which is also nowhere defined... its just a thing the game does.

Is there a way i can force the remaining (mirrored) sprites to be loaded from the spritesheet or better yet is there a way to define a different offset for the mirrored versions separately?

EDIT: I figured it out.

So for anyone wondering, despite the base character sprite doing this, avoid offsetting all of your other animations on the x coordinate. I suspect that shifting pixels on the x coordinate in combination with mirroring the available sprites gets out of whack when the other base animations you'd "base" your assumption of the characters center point on are also offset, probably due to the way the mirroring works. I suspect that rather than defining origin at the original 0,0 then taking the shift starting at the top-left and shifting sprites from there then mirroring this shift to the other side (starting at top-right) it probably does something entirely different that seems a mystery to me. I'd expect a 5 pixel shift to be applied from 0,0 to both sprites equally. Meaning if i shift by 5 pixel to the right for the right facing sprites, i'd start counting from the center point 5 pixel to the right and then insert the image starting top-left, whereas for the mirrored version i'd do the opposite and count 5 pixel to the left (-5 pixel) and start from the top-right (or add the image width as additional offset so i'd end up at the top-left plus the 5 pixel offset to the left) and place it there, this would guarantee that any offset is properly mirrored to both sides.