Sprite Animation Position

Started by kruz, December 03, 2010, 09:09:40 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

kruz

I'm not sure if I should be putting this in the helpdesk or another section, so I'm hoping here is fine.

I used some helpful beginner tutorials to learn some of the basics on loading images and getting them to scroll around on the screen.

I'm working on a 2D platform game eg. Super Mario Brothers like.  My character has animations for Jumping/Walking/Running but the size of the image is different based on what he is doing.  For example, the standing animation is 28x66, falling is 36x62, running is 52x44.  I'm trying to figure out what best practices others have used to account for the difference in size on the animation.

Should I try to find a size to accommodate all of the animations and just center the character on that size of square?  Would that possibly affect the collision detection if I do it that way, eg. character is falling and he is shorter than when he stands how would I prevent from falling through the floor or make sure that the animation is perfectly standing on the ground.  That also leads to the question of how to get the character to stand right next to the wall if the collision is detected when he is running as the running animation is much wider than the walking one.

There's the option of having an invisible sprite that is a small block which would be invisible to the player but have the same type of coordinates to the program so that I can detect collisions on the box and not the character himself.

Anyway, I'm just curious as to what others think.  I'm really considering going with the second option.

Thank you for your input!
-Kruz

FreeYourMind

You can use a second map (hardness map) with colors from colision for your caracter, and fix a color to use in colission in the right area.

panreyes

You have two basic options:
-Changing the center of the maps, by using set_center
-Having the character always in a fixed size. It won't affect to collision as it does a pixel-perfect collision. If there's no color in that pixel, there's no collision.

handsource-dyko

I recommend using a fixed size, that's big enough for all possible animations.
Also, Hardness maps work fine. (be sure to make them 8-bit, works better).

You could also have a look at my improved version of malvado, wich you can
download from the bennupack suppliers).

By the way, a new version is coming out soon, I plan to release it in 1 or 2 months.

kruz

Thank you guys for the quick responses.  I'll look into using the hardness map because I don't think just having the character collision would work for my purposes.  My character is holding items so in a situation where the player is falling, the item might clip a ledge and when the animation switches to him standing, it might miss the ledge entirely.

As far as making the maps 8bit, I'll have to see if my sprites will not lose colour quality.  They were all 16bit and in several png files.  I'm working on cutting the images and making an fpg file instead.