Ejemplo n.º 1
0
        AnimSprite asShoes;        // Обувь

        public Player(World world) : base(world)
        {
            rect          = new RectangleShape(new Vector2f(Tile.TILE_SIZE * 1.5f, Tile.TILE_SIZE * 2.8f));
            rect.Origin   = new Vector2f(rect.Size.X / 2, 0);
            isRectVisible = true;

            // Волосы
            asHair          = new AnimSprite(Content.ssPlayerHair);
            asHair.Position = new Vector2f(0, 19);
            asHair.Color    = HairColor;
            asHair.AddAnimation("idle", new Animation(
                                    new AnimationFrame(0, 0, 0.1f)
                                    ));
            asHair.AddAnimation("run", new Animation(
                                    new AnimationFrame(0, 0, 0.1f),
                                    new AnimationFrame(0, 1, 0.1f),
                                    new AnimationFrame(0, 2, 0.1f),
                                    new AnimationFrame(0, 3, 0.1f),
                                    new AnimationFrame(0, 4, 0.1f),
                                    new AnimationFrame(0, 5, 0.1f),
                                    new AnimationFrame(0, 6, 0.1f),
                                    new AnimationFrame(0, 7, 0.1f),
                                    new AnimationFrame(0, 8, 0.1f),
                                    new AnimationFrame(0, 9, 0.1f),
                                    new AnimationFrame(0, 10, 0.1f),
                                    new AnimationFrame(0, 11, 0.1f),
                                    new AnimationFrame(0, 12, 0.1f),
                                    new AnimationFrame(0, 13, 0.1f)
                                    ));

            // Голова
            asHead          = new AnimSprite(Content.ssPlayerHead);
            asHead.Position = new Vector2f(0, 19);
            asHead.Color    = BodyColor;
            asHead.AddAnimation("idle", new Animation(
                                    new AnimationFrame(0, 0, 0.1f)
                                    ));
            asHead.AddAnimation("run", new Animation(
                                    new AnimationFrame(0, 6, 0.1f),
                                    new AnimationFrame(0, 7, 0.1f),
                                    new AnimationFrame(0, 8, 0.1f),
                                    new AnimationFrame(0, 9, 0.1f),
                                    new AnimationFrame(0, 10, 0.1f),
                                    new AnimationFrame(0, 11, 0.1f),
                                    new AnimationFrame(0, 12, 0.1f),
                                    new AnimationFrame(0, 13, 0.1f),
                                    new AnimationFrame(0, 14, 0.1f),
                                    new AnimationFrame(0, 15, 0.1f),
                                    new AnimationFrame(0, 16, 0.1f),
                                    new AnimationFrame(0, 17, 0.1f),
                                    new AnimationFrame(0, 18, 0.1f),
                                    new AnimationFrame(0, 19, 0.1f)
                                    ));

            // Рубашка
            asShirt          = new AnimSprite(Content.ssPlayerShirt);
            asShirt.Position = new Vector2f(0, 19);
            asShirt.Color    = ShirtColor;
            asShirt.AddAnimation("idle", new Animation(
                                     new AnimationFrame(0, 0, 0.1f)
                                     ));
            asShirt.AddAnimation("run", new Animation(
                                     new AnimationFrame(0, 6, 0.1f),
                                     new AnimationFrame(0, 7, 0.1f),
                                     new AnimationFrame(0, 8, 0.1f),
                                     new AnimationFrame(0, 9, 0.1f),
                                     new AnimationFrame(0, 10, 0.1f),
                                     new AnimationFrame(0, 11, 0.1f),
                                     new AnimationFrame(0, 12, 0.1f),
                                     new AnimationFrame(0, 13, 0.1f),
                                     new AnimationFrame(0, 14, 0.1f),
                                     new AnimationFrame(0, 15, 0.1f),
                                     new AnimationFrame(0, 16, 0.1f),
                                     new AnimationFrame(0, 17, 0.1f),
                                     new AnimationFrame(0, 18, 0.1f),
                                     new AnimationFrame(0, 19, 0.1f)
                                     ));

            // Рукава
            asUndershirt          = new AnimSprite(Content.ssPlayerUndershirt);
            asUndershirt.Position = new Vector2f(0, 19);
            asUndershirt.AddAnimation("idle", new Animation(
                                          new AnimationFrame(0, 0, 1f)
                                          ));
            asUndershirt.AddAnimation("run", new Animation(
                                          new AnimationFrame(0, 6, 0.1f),
                                          new AnimationFrame(0, 7, 0.1f),
                                          new AnimationFrame(0, 8, 0.1f),
                                          new AnimationFrame(0, 9, 0.1f),
                                          new AnimationFrame(0, 10, 0.1f),
                                          new AnimationFrame(0, 11, 0.1f),
                                          new AnimationFrame(0, 12, 0.1f),
                                          new AnimationFrame(0, 13, 0.1f),
                                          new AnimationFrame(0, 14, 0.1f),
                                          new AnimationFrame(0, 15, 0.1f),
                                          new AnimationFrame(0, 16, 0.1f),
                                          new AnimationFrame(0, 17, 0.1f),
                                          new AnimationFrame(0, 18, 0.1f),
                                          new AnimationFrame(0, 19, 0.1f)
                                          ));

            // Кисти
            asHands          = new AnimSprite(Content.ssPlayerHands);
            asHands.Position = new Vector2f(0, 19);
            asHands.Color    = BodyColor;
            asHands.AddAnimation("idle", new Animation(
                                     new AnimationFrame(0, 0, 0.1f)
                                     ));
            asHands.AddAnimation("run", new Animation(
                                     new AnimationFrame(0, 6, 0.1f),
                                     new AnimationFrame(0, 7, 0.1f),
                                     new AnimationFrame(0, 8, 0.1f),
                                     new AnimationFrame(0, 9, 0.1f),
                                     new AnimationFrame(0, 10, 0.1f),
                                     new AnimationFrame(0, 11, 0.1f),
                                     new AnimationFrame(0, 12, 0.1f),
                                     new AnimationFrame(0, 13, 0.1f),
                                     new AnimationFrame(0, 14, 0.1f),
                                     new AnimationFrame(0, 15, 0.1f),
                                     new AnimationFrame(0, 16, 0.1f),
                                     new AnimationFrame(0, 17, 0.1f),
                                     new AnimationFrame(0, 18, 0.1f),
                                     new AnimationFrame(0, 19, 0.1f)
                                     ));

            // Ноги
            asLegs          = new AnimSprite(Content.ssPlayerLegs);
            asLegs.Color    = LegsColor;
            asLegs.Position = new Vector2f(0, 19);
            asLegs.AddAnimation("idle", new Animation(
                                    new AnimationFrame(0, 0, 0.1f)
                                    ));
            asLegs.AddAnimation("run", new Animation(
                                    new AnimationFrame(0, 6, 0.1f),
                                    new AnimationFrame(0, 7, 0.1f),
                                    new AnimationFrame(0, 8, 0.1f),
                                    new AnimationFrame(0, 9, 0.1f),
                                    new AnimationFrame(0, 10, 0.1f),
                                    new AnimationFrame(0, 11, 0.1f),
                                    new AnimationFrame(0, 12, 0.1f),
                                    new AnimationFrame(0, 13, 0.1f),
                                    new AnimationFrame(0, 14, 0.1f),
                                    new AnimationFrame(0, 15, 0.1f),
                                    new AnimationFrame(0, 16, 0.1f),
                                    new AnimationFrame(0, 17, 0.1f),
                                    new AnimationFrame(0, 18, 0.1f),
                                    new AnimationFrame(0, 19, 0.1f)
                                    ));

            // Обувь
            asShoes          = new AnimSprite(Content.ssPlayerShoes);
            asShoes.Position = new Vector2f(0, 19);
            asShoes.AddAnimation("idle", new Animation(
                                     new AnimationFrame(0, 0, 1f)
                                     ));
            asShoes.AddAnimation("run", new Animation(
                                     new AnimationFrame(0, 6, 0.1f),
                                     new AnimationFrame(0, 7, 0.1f),
                                     new AnimationFrame(0, 8, 0.1f),
                                     new AnimationFrame(0, 9, 0.1f),
                                     new AnimationFrame(0, 10, 0.1f),
                                     new AnimationFrame(0, 11, 0.1f),
                                     new AnimationFrame(0, 12, 0.1f),
                                     new AnimationFrame(0, 13, 0.1f),
                                     new AnimationFrame(0, 14, 0.1f),
                                     new AnimationFrame(0, 15, 0.1f),
                                     new AnimationFrame(0, 16, 0.1f),
                                     new AnimationFrame(0, 17, 0.1f),
                                     new AnimationFrame(0, 18, 0.1f),
                                     new AnimationFrame(0, 19, 0.1f)
                                     ));
        }
Ejemplo n.º 2
0
        AnimSprite asShoes;        // Обувь



        public Player(World world) : base(world)
        {
            rect          = new RectangleShape(new Vector2f(Tile.TILE_SIZE * 1.5f, Tile.TILE_SIZE * 2.8f));
            rect.Origin   = new Vector2f(rect.Size.X / 2, 0);
            isRectVisible = false;

            // Волосы
            asHair          = new AnimSprite(Content.texPlayerHair, new SpriteSheet(1, 14, 0, (int)Content.texPlayerHair.Size.X, (int)Content.texPlayerHair.Size.Y));
            asHair.Position = new Vector2f(0, PLAYER_SPTITE_POSITION_Y);
            asHair.Color    = HairColor;
            asHair.AddAnimation("idle", new Animation(      // Анимация ожидания
                                    new AnimtionFrame(0, 0, 0.1f)
                                    ));
            asHair.AddAnimation("run", new Animation(      // Анимация бега
                                    new AnimtionFrame(0, 0, 0.1f),
                                    new AnimtionFrame(0, 1, 0.1f),
                                    new AnimtionFrame(0, 2, 0.1f),
                                    new AnimtionFrame(0, 3, 0.1f),
                                    new AnimtionFrame(0, 4, 0.1f),
                                    new AnimtionFrame(0, 5, 0.1f),
                                    new AnimtionFrame(0, 6, 0.1f),
                                    new AnimtionFrame(0, 7, 0.1f),
                                    new AnimtionFrame(0, 8, 0.1f),
                                    new AnimtionFrame(0, 9, 0.1f),
                                    new AnimtionFrame(0, 10, 0.1f),
                                    new AnimtionFrame(0, 11, 0.1f),
                                    new AnimtionFrame(0, 12, 0.1f),
                                    new AnimtionFrame(0, 13, 0.1f)
                                    ));

            // Голова
            asHead          = new AnimSprite(Content.texPlayerHead, new SpriteSheet(1, 20, 0, (int)Content.texPlayerHead.Size.X, (int)Content.texPlayerHead.Size.Y));
            asHead.Position = new Vector2f(0, PLAYER_SPTITE_POSITION_Y);
            asHead.Color    = BodyColor;
            asHead.AddAnimation("idle", new Animation(      // Анимация ожидания
                                    new AnimtionFrame(0, 0, 0.1f)
                                    ));
            asHead.AddAnimation("run", new Animation(      // Анимация бега
                                    new AnimtionFrame(0, 6, 0.1f),
                                    new AnimtionFrame(0, 7, 0.1f),
                                    new AnimtionFrame(0, 8, 0.1f),
                                    new AnimtionFrame(0, 9, 0.1f),
                                    new AnimtionFrame(0, 10, 0.1f),
                                    new AnimtionFrame(0, 11, 0.1f),
                                    new AnimtionFrame(0, 12, 0.1f),
                                    new AnimtionFrame(0, 13, 0.1f),
                                    new AnimtionFrame(0, 14, 0.1f),
                                    new AnimtionFrame(0, 15, 0.1f),
                                    new AnimtionFrame(0, 16, 0.1f),
                                    new AnimtionFrame(0, 17, 0.1f),
                                    new AnimtionFrame(0, 18, 0.1f),
                                    new AnimtionFrame(0, 19, 0.1f)
                                    ));

            // Куртка
            asShirt          = new AnimSprite(Content.texPlayerShirt, new SpriteSheet(1, 20, 0, (int)Content.texPlayerShirt.Size.X, (int)Content.texPlayerShirt.Size.Y));
            asShirt.Position = new Vector2f(0, PLAYER_SPTITE_POSITION_Y);
            asShirt.Color    = ShirtColor;
            asShirt.AddAnimation("idle", new Animation(      // Анимация ожидания
                                     new AnimtionFrame(0, 0, 0.1f)
                                     ));
            asShirt.AddAnimation("run", new Animation(      // Анимация бега
                                     new AnimtionFrame(0, 6, 0.1f),
                                     new AnimtionFrame(0, 7, 0.1f),
                                     new AnimtionFrame(0, 8, 0.1f),
                                     new AnimtionFrame(0, 9, 0.1f),
                                     new AnimtionFrame(0, 10, 0.1f),
                                     new AnimtionFrame(0, 11, 0.1f),
                                     new AnimtionFrame(0, 12, 0.1f),
                                     new AnimtionFrame(0, 13, 0.1f),
                                     new AnimtionFrame(0, 14, 0.1f),
                                     new AnimtionFrame(0, 15, 0.1f),
                                     new AnimtionFrame(0, 16, 0.1f),
                                     new AnimtionFrame(0, 17, 0.1f),
                                     new AnimtionFrame(0, 18, 0.1f),
                                     new AnimtionFrame(0, 19, 0.1f)
                                     ));

            // Рукова
            asUndershirt          = new AnimSprite(Content.texPlayerUndershirt, new SpriteSheet(1, 20, 0, (int)Content.texPlayerUndershirt.Size.X, (int)Content.texPlayerUndershirt.Size.Y));
            asUndershirt.Position = new Vector2f(0, PLAYER_SPTITE_POSITION_Y);
            asUndershirt.Color    = ShirtColor;
            asUndershirt.AddAnimation("idle", new Animation(      // Анимация ожидания
                                          new AnimtionFrame(0, 0, 0.1f)
                                          ));
            asUndershirt.AddAnimation("run", new Animation(      // Анимация бега
                                          new AnimtionFrame(0, 6, 0.1f),
                                          new AnimtionFrame(0, 7, 0.1f),
                                          new AnimtionFrame(0, 8, 0.1f),
                                          new AnimtionFrame(0, 9, 0.1f),
                                          new AnimtionFrame(0, 10, 0.1f),
                                          new AnimtionFrame(0, 11, 0.1f),
                                          new AnimtionFrame(0, 12, 0.1f),
                                          new AnimtionFrame(0, 13, 0.1f),
                                          new AnimtionFrame(0, 14, 0.1f),
                                          new AnimtionFrame(0, 15, 0.1f),
                                          new AnimtionFrame(0, 16, 0.1f),
                                          new AnimtionFrame(0, 17, 0.1f),
                                          new AnimtionFrame(0, 18, 0.1f),
                                          new AnimtionFrame(0, 19, 0.1f)
                                          ));

            // Кисти рук
            asHands          = new AnimSprite(Content.texPlayerHands, new SpriteSheet(1, 20, 0, (int)Content.texPlayerHands.Size.X, (int)Content.texPlayerHands.Size.Y));
            asHands.Position = new Vector2f(0, PLAYER_SPTITE_POSITION_Y);
            asHands.Color    = BodyColor;
            asHands.AddAnimation("idle", new Animation(      // Анимация ожидания
                                     new AnimtionFrame(0, 0, 0.1f)
                                     ));
            asHands.AddAnimation("run", new Animation(      // Анимация бега
                                     new AnimtionFrame(0, 6, 0.1f),
                                     new AnimtionFrame(0, 7, 0.1f),
                                     new AnimtionFrame(0, 8, 0.1f),
                                     new AnimtionFrame(0, 9, 0.1f),
                                     new AnimtionFrame(0, 10, 0.1f),
                                     new AnimtionFrame(0, 11, 0.1f),
                                     new AnimtionFrame(0, 12, 0.1f),
                                     new AnimtionFrame(0, 13, 0.1f),
                                     new AnimtionFrame(0, 14, 0.1f),
                                     new AnimtionFrame(0, 15, 0.1f),
                                     new AnimtionFrame(0, 16, 0.1f),
                                     new AnimtionFrame(0, 17, 0.1f),
                                     new AnimtionFrame(0, 18, 0.1f),
                                     new AnimtionFrame(0, 19, 0.1f)
                                     ));

            // Ноги
            asLegs          = new AnimSprite(Content.texPlayerLegs, new SpriteSheet(1, 20, 0, (int)Content.texPlayerLegs.Size.X, (int)Content.texPlayerLegs.Size.Y));
            asLegs.Position = new Vector2f(0, PLAYER_SPTITE_POSITION_Y);
            asLegs.Color    = LegsColor;
            asLegs.AddAnimation("idle", new Animation(      // Анимация ожидания
                                    new AnimtionFrame(0, 0, 0.1f)
                                    ));
            asLegs.AddAnimation("run", new Animation(      // Анимация бега
                                    new AnimtionFrame(0, 6, 0.1f),
                                    new AnimtionFrame(0, 7, 0.1f),
                                    new AnimtionFrame(0, 8, 0.1f),
                                    new AnimtionFrame(0, 9, 0.1f),
                                    new AnimtionFrame(0, 10, 0.1f),
                                    new AnimtionFrame(0, 11, 0.1f),
                                    new AnimtionFrame(0, 12, 0.1f),
                                    new AnimtionFrame(0, 13, 0.1f),
                                    new AnimtionFrame(0, 14, 0.1f),
                                    new AnimtionFrame(0, 15, 0.1f),
                                    new AnimtionFrame(0, 16, 0.1f),
                                    new AnimtionFrame(0, 17, 0.1f),
                                    new AnimtionFrame(0, 18, 0.1f),
                                    new AnimtionFrame(0, 19, 0.1f)
                                    ));

            // Обувь
            asShoes          = new AnimSprite(Content.texPlayerShoes, new SpriteSheet(1, 20, 0, (int)Content.texPlayerShoes.Size.X, (int)Content.texPlayerShoes.Size.Y));
            asShoes.Position = new Vector2f(0, PLAYER_SPTITE_POSITION_Y);
            asShoes.Color    = Color.Black;
            asShoes.AddAnimation("idle", new Animation(      // Анимация ожидания
                                     new AnimtionFrame(0, 0, 0.1f)
                                     ));
            asShoes.AddAnimation("run", new Animation(      // Анимация бега
                                     new AnimtionFrame(0, 6, 0.1f),
                                     new AnimtionFrame(0, 7, 0.1f),
                                     new AnimtionFrame(0, 8, 0.1f),
                                     new AnimtionFrame(0, 9, 0.1f),
                                     new AnimtionFrame(0, 10, 0.1f),
                                     new AnimtionFrame(0, 11, 0.1f),
                                     new AnimtionFrame(0, 12, 0.1f),
                                     new AnimtionFrame(0, 13, 0.1f),
                                     new AnimtionFrame(0, 14, 0.1f),
                                     new AnimtionFrame(0, 15, 0.1f),
                                     new AnimtionFrame(0, 16, 0.1f),
                                     new AnimtionFrame(0, 17, 0.1f),
                                     new AnimtionFrame(0, 18, 0.1f),
                                     new AnimtionFrame(0, 19, 0.1f)
                                     ));
        }