dcsimg
A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: detecting the "ground"

  1. #1

    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
    So many Ideas

    So little Time

  2. #2
    Senior Member
    Join Date
    Jun 2003
    Location
    Kent, WA
    Posts
    536
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center