Conceptual player and ground collision question

[COLOR=“DarkRed”]NEVERMIND. I figured it out. This is the first time I think I have the concept down right, but my issue was that during each frame, I was adding gravity AFTER checking for collision. I thought I should leave the post intact just in case it helps someone else.[/COLOR]

I’ve never actually been able to figure out this specific issue, but I am trying once again to make a flash game which has a player falling onto ground at some point with gravity being the reason.

I need to make sure I have this right conceptually. My player has a variable vy. The player movie clip has it’s x,y at the bottom left of the image. The ground movie clip has it’s x,y at the top left of the image.

Each frame, I add gravity (ex. 1 pixel/second) to the vy variable. So it is accelerating the player down. However, before I actually add the vy value to the player’s y value, I check to see if the player’s next position will collide with the ground. To do this, I use hitTestPoint. Specifically, I run ground’s hitTestPoint on the x,y+1 of the character (so the point just below my player), and on every value up to x,y+vy. This is to check the character isn’t flying right through the ground.

Hopefully I am making sense so far.
If that collision test doesn’t return true, then I go ahead and add the vy to the y value of the character.
However, if it returns true, I set the vy to 0. I also move the player x,y to one pixel above the ground x,y value.

My problem is that the player falls, hits the ground, and then keeps getting bumped up and down one pixel.
I tested ground’s hitTestObject on the player, and it is returning true. If I am thinking correctly, shouldn’t this never return true? I thought I set it up so that the player’s box never actually hit’s the ground’s box, because of the prediction using hitTestPoint…

I believe this problem is what caused huge issues down the line for me once before when I attempted to make a game. What am I doing wrong? Thank you.