-
detecting the "ground"
Hello all!
I'm trying to creat a 2d side scroller type, just started like an hour ago. Basically the problem I have is making this "character" land on the ground after jumping. I have the physics and stuff laid out. All I need to make him land in the right place. Right now, The character lands on the yMin(the topmost part) of the ground(a separate MC). I used this code to detect it.
Code:
if (feet.getBounds(_root).yMax>_parent.ground.getBounds(_root).yMin)
That works fine on flat ground. But If I make a ledge, higher than the ground you are currently standing on, he will land just as high as that ledge.. Makes sense.
My question, is there a way to make the getBounds function to detect the yMin of the ground AT the characters specific _x value? I tried a few methods, but none work. I'm trying to not use the hitTest function. Can someone give any advice???
Thanks a ton.
~The Bill
-
No, you need to use hitTest. You have to check the bottom point of the character with the level movieclip. Unless you want to do it mathematically, but that's a headache.