public void HitWall(Body wall) { int frame = (int)wall.GetUserData(); GotoAndStop((uint)frame); }
void CreateJoint(Body other, Vector2 contact) { // cannot move from stable situation to unstable if (isStable && other.GetUserData() is Soldier && !((Soldier)other.GetUserData()).isStable) return; DestroyJoint(); if (!(other.GetUserData() is Soldier) || ((Soldier)other.GetUserData()).joint == null || ((Soldier)other.GetUserData()).joint.GetBodyB() != body) { DistanceJointDef jd = new DistanceJointDef(); //jd.frequencyHz = 10; jd.dampingRatio = 0f; jd.Initialize(body, other, body.Position, contact); jd.length = Size / 2 / gameContent.b2Scale; jd.collideConnected = true; joint = body.GetWorld().CreateJoint(jd); if (joint.GetBodyB().GetUserData() is Soldier) isStable = ((Soldier)joint.GetBodyB().GetUserData()).isStable; else isStable = true; } }