to get top of platform i would have to do...
Or, since player_BOTTOM_LEFT_Y should always equal player_BOTTOM_RIGHT_Y:
if( playerFootHeight > groundHeight ) {
player.falling = true;
}
So picture the bounding box around the player. Rather than visualizing the 4 corners of the box, as player_BOTTOM_LEFT and player_BOTTOM_RIGHT, see the edges of the rectangle.
The top of the rectangle is the upper limit for the height.
The bottom of the rectangle is the lower limit for the height.
The right of the rectangle is the leading edge (for example)
The left of the rectangle is the trailing edge.
So you can see two points hold the y value for the feet height, or bottom of the rectangle. It simply does not matter which point you get the y value from, it is the same value. The test only needs to be done once.
Say the player is in a jump, and attempting to land on a platform. The requirements of landing on the platform would be something like:
if player feet are higher than platform top
if player right edge is past platform left edge
if player left edge is NOT past platform right edge
player is now over top of the platform and falling...
while player stays between edges of platform
if player feet height == platform top
player has landed on platform successfully
There are many different ways to write code to detect the conditions, some better than others as is always the case. (depending on the specifics)
So in my left-to-right jump, needing to land on an edge, the first important point to consider is the (player_BOTTOM_RIGHT_X, player_BOTTOM_RIGHT_Y) as this gives the leading edge of the player and the foot height. From that point we can detect if we caught the edge of a platform with the tip of our toes, or by a good safe landing. With just this single point, as long as that point does not go off the edge of the platform, the player can not fall off and no other point currently matters. If this point passes the left side of the platform, the player fell off the left side of the platform. If this point passes the right side of the platform, now we have to look at the bottom left corner point of the player. Only when this point goes past the right side of the platform, the player falls off the right side.
I feel like I am rambling on.... hope it helps.