public SmileyWalkDude() : base() { // get the animation texture _smileyWalkTexture = ContentLoader.Content.Load<Texture2D>(Assets.SMILEY_WALK); // make the animator Animation standing = new Animation(_smileyWalkTexture, 300, 4, 4, 2); Animation walking = new Animation(_smileyWalkTexture, 300, 4, 4, 16, true); anim = new Animator(standing); anim.AddAnimation(AnimationNames.WALKING, walking); anim.DrawOrder = 5; AddComponent(anim); // make the body body = new Body(); body.Resistance = 0.9f; AddComponent(body); // make the collider collider = new BoxCollider(new Point(anim.Width * 5, anim.Height * 5)); collider.WireFrame = WireFrames.BoxWireFrame(collider.Bounds); AddComponent(collider); collider.CollisionStart += UpdateMessage; collider.CollisionEnd += UpdateMessage; // make the input input = new InputManager(); input.AddAxis(InputNames.X_AXIS, Keys.D, Keys.A); input.AddAxis(InputNames.Y_AXIS, Keys.S, Keys.W); AddComponent(input); }
private void AddBody() { Body = new Body() { Owner = this }; }