Example #1
0
        public void InitializeAnimations()
        {
            var w = (int)Size.X;
            var h = (int)Size.Y;

            // Right
            _animations.Add(PlayerAnimationNames.IdleRight, 1, new List <Rectangle> {
                new Rectangle(0, 0, w, h)
            });
            _animations.Add(PlayerAnimationNames.UseRight, 1, new List <Rectangle> {
                new Rectangle(32, 0, w, h)
            });
            _animations.Add(PlayerAnimationNames.WalkRight, 1, new List <Rectangle>
            {
                new Rectangle(64, 0, w, h),
                new Rectangle(96, 0, w, h),
                new Rectangle(128, 0, w, h),
                new Rectangle(160, 0, w, h),
                new Rectangle(192, 0, w, h),
                new Rectangle(224, 0, w, h),
                new Rectangle(256, 0, w, h),
                new Rectangle(288, 0, w, h),
            });

            // Left
            _animations.Add(PlayerAnimationNames.IdleLeft, 1, new List <Rectangle> {
                new Rectangle(0, 48, w, h)
            });
            _animations.Add(PlayerAnimationNames.UseLeft, 1, new List <Rectangle> {
                new Rectangle(32, 48, w, h)
            });
            _animations.Add(PlayerAnimationNames.WalkLeft, 1, new List <Rectangle>
            {
                new Rectangle(64, 48, w, h),
                new Rectangle(96, 48, w, h),
                new Rectangle(128, 48, w, h),
                new Rectangle(160, 48, w, h),
                new Rectangle(192, 48, w, h),
                new Rectangle(224, 48, w, h),
                new Rectangle(256, 48, w, h),
                new Rectangle(288, 48, w, h),
            });

            _animations.ChangeAnimation(PlayerAnimationNames.IdleRight);
        }