putting a created circle's x,y in a specific place on MC

Hello,

I'm working on a flash game as an introduction to a client website, and I was hoping the kind people on this forum could help me with a little problem I'm having.

What I have now is a little creature that walks back and forth across the screen. What I am trying to do is create a b2CircleDef behind his head, and not the center of the MovieClip. When I do it now it shows in the middle of his body (and also half of the movieclip is hidden below the window because of the circle's gravity); the goal is that someone can pick him up by the head wherever he is on stage while he is walking.

So I guess my main concern right now is how can I make a b2CircleDef stop at a certain x coordinate, and how can I position a b2CircleDef's x and y coordinates so they are located behind the movieclip's head instead of the movieclip's center.

Can someone please help me? Offering anything would be greatly appreciated. I'm not looking for someone to write the code, I'm just looking for a push in the right direction.

Thank you 😀
I'm not 100% sure if this is a solution to the problem you're having but I hope it helps:

In your fla file, do you have a symbol representing the head? If you double click on it to edit it, you can move it (note: set the values precisely rather than dragging the object to roughly the centre otherwise you'll have problems) so that it's origin is actually in the centre of the circle, rather than the top left hand corner. I've had to do this quite a few times myself in a game I'm coding.
this is one of those moments where I smack myself on the head for realizing how simple that is.

I figured it must be in Box2d; it never crossed my mind to change the position in the actual Movie clip.

Thank you Dinkyfish 🙂

Now all I have to do is make it so the circleDef stops at a certain y coordinate and move back and forth.
so I've been trying to research on this forum how to stop gravity when the ballDef reaches a certain Y coordinate. I haven't been very successful.

What I tried myself was allocating a new b2Vec2 called gravity2 with (0.0, 0.0), and assigning it to the original gravity when the movieclip reaches a certain Y coordinate: in other words:

Code:
if (Falling.y < 20)
      {
                  // trace("lafkj");
                  var gravity2:b2Vec2 = new b2Vec2(0.0, 0.0);
                  gravity = gravity2;
      }


However, this does not work, and I am a bit frazzled right now as to what to do next.

I'd appreciate any help you could give. My goal is to stop the gravity at a certain point, and actually the collision detection as well, at a certain Y coordinate so it appears my movieclips are walking on screen (so the user can pick them up and have gravity and collision detection.)

Could someone please point me in the right direction?
Thank you 🙂
You could always raise your ground collision volume up to the desired point. If you have no physics on the body and its just graphics attached to the head then there is no need to worry about if it overlaps the 'ground'. Of course, just position your ground graphic where you actually want it to appear and let the physics object be invisible.
Thank you VengantMjolnir, so I created BoxDef where I want it, and the movieclip of the floor below (to make it look like the character is standing.)

I just have one question. Now that I've done that, how do I make the BoxDef invisible? is there a .Alpha function associated with Box2D? I tried using .alpha with no success.

I consulted the wiki which said something along the lines of "m_fillAlpha " but could not get it to work either.

Thanks
-Jack
You could just not draw the debug data... Box2D really has nothing to do with how you draw the world, it just spits out position and rotation for bodies.
More than once you have helped me out with Box2d,

Thank you very much, VengantMjolnir.

Original thread: https://box2d.org/forum/viewtopic.php?t=4748