コード例 #1
0
        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);
        }
コード例 #2
0
ファイル: Animator.cs プロジェクト: axis7818/AxisEngine
        public Animator(Animation defaultAnimation)
        {
            _offset = Vector2.Zero;

            _animations = new Dictionary<string, Animation>();
            _currentAnimation = DEFAULT;
            _animations[DEFAULT] = defaultAnimation;

            DrawOrder = 0;
            Color = Color.White;
            Origin = Vector2.Zero;
            Rotation = 0;
            SpriteEffect = SpriteEffects.None;
            LayerDepth = 0;
            DestinationRectangle = null;
            Visible = true;
        }
コード例 #3
0
 public AnimationEventArgs(Animation animation)
 {
     Animation = animation;
 }
コード例 #4
0
ファイル: Animator.cs プロジェクト: axis7818/AxisEngine
        public void AddAnimation(string name, Animation anim)
        {
            if (_animations.ContainsKey(name))
                throw new ArgumentException("animation [" + name + "] is already in the animator");

            _animations[name] = anim;
        }