Ok, so far I have learned almost everything I need to know about making a platform game :D. The last thing that I need for this platform game, is how to make the hero not sink too far into or above the ground. I have checked through the other threads on this problem, but they didn’t help me, so if any one could help me eliminate this problem, I would be most thankful. Thanks in advance!
peace
P.S. Here is the code I use for the ground:
if (_root.ground.hitTest(this._x, this._y+15, true)) {
if (vel_y<=1) {
fall = 0;
vel_y = 0;
jumping = false;
move = false;
}
}
try making it so if the is on the ground he slides up by increments of 1 so if the hitests it he goes up one or two pixels for as long as he hits it so hes not sunk in.
The only sure fire way to make him go where he belongs is, after you know he hit the ground… Just move him.
if you are gathering the hitTest from his feet, which it looks like it… Take the height of the tile / ground piece you are currently hitting and then find the y of that and increment it enough to make the feet be exactly the same spot as the top of the land…
Say you have a piece of land that is… 30 pixels of _width and it’s at 200 pixels of _y take 200 - (30 / 2) and you have where your feet should land… As long as you are getting the values from the center of the landpiece and the feet of the player character… you will be fine