[SOLVED] Bottom of the Screen

Started by Gurok, Sat 24/05/2014 18:10:36

Previous topic - Next topic

Snarky

I'm still not sure why you think it's important that characters should be able to move exactly so their sprites align with the edge.

As for setting character.z, the main reason to my mind is so the character lines up from all angles. If the characters are viewed straight from the side it doesn't matter, but these sprites are viewed from a fairly high angle, so you're getting a lot of perspective effects, where the position of the feet depends a lot on which side you're viewing it from.

My basic assumption is that if the character is standing in a certain spot, the height of the head should be independent of what direction he/she is facing (assuming character standing straight upright). In order to achieve that, the point on the ground right under the head should be used as the character's position. Here's a rough and exaggerated illustration:

[imgzoom]http://i.cubeupload.com/G3llvG.jpg[/imgzoom]

If you always use the center of the circle as the character's coordinate, all the angles and animations should look consistent.

Gurok

Quote from: Snarky on Mon 26/05/2014 14:13:43
I'm still not sure why you think it's important that characters should be able to move exactly so their sprites align with the edge.

I don't. I'm not pursuing this. Both of the methods I've identified aren't really practical.

Quote from: Snarky on Mon 26/05/2014 14:13:43
As for setting character.z, the main reason to my mind is so the character lines up from all angles. If the characters are viewed straight from the side it doesn't matter, but these sprites are viewed from a fairly high angle, so you're getting a lot of perspective effects, where the position of the feet depends a lot on which side you're viewing it from.

My basic assumption is that if the character is standing in a certain spot, the height of the head should be independent of what direction he/she is facing (assuming character standing straight upright). In order to achieve that, the point on the ground right under the head should be used as the character's position. Here's a rough and exaggerated illustration:

[imgzoom]http://i.cubeupload.com/G3llvG.jpg[/imgzoom]

If you always use the center of the circle as the character's coordinate, all the angles and animations should look consistent.

But altering a character's .z value doesn't alter that. The sprites are already drawn so that the centre point of the feet is the centre point of the character's rotation. Billbis' point is worth considering though.
[img]http://7d4iqnx.gif;rWRLUuw.gi

Snarky

Well, then you're in a position where the alignment of the sprite is set by the frame that extends down the most, and with other angles/frames there might be a gap of several pixels at the bottom. Which comes back to the point that the characters don't "go where you clicked" (more precisely, their apparent position is offset from their logical position). And as Khris says, this can lead to problems with scaling, tinting, walkbehinds, etc, etc.

In certain cases, you might even end up with two characters being drawn in the wrong order because one of them has a frame that extends further down than the other, so by using that bottom edge (several pixels below its actual feet) as its position, you're making the game think the character is closer, even though visually it's further away.

Khris

Let's say we have a sprite with a footprint of 21x9 pixels. Wouldn't it be amazing if we could simply draw the area at a vertical distance of 5 and a horizontal distance of 11 from walls and other obstructions? Wouldn't it be great if we didn't have to worry about engine "quirks" and other related stuff at all while doing so?
Wouldn't it be great if we didn't have to draw the walkable areas shifted down because the entire sprite footprint is above the player's engine position?
Won't the players thanks us if the characters actually move where we tell them to?

Guess what, thats all easily achieved by setting player.z to -5.

-But doesn't that screw up the sprites I have already drawn?

Not in the least!

SMF spam blocked by CleanTalk