コード例 #1
0
        public override void init()
        {
            base.init();

            graphic = new bSpritemap(game.Content.Load<Texture2D>("npc"), 16, 24);
            graphic.add(new bAnim("idle", new int[] { 0, 1 }, 0.3f));
            graphic.play("idle");

            shadowGraphic = new bStamp(game.Content.Load<Texture2D>("shadow"));
            shadowGraphic.alpha = 0.4f;

            /*mask.offsety = 8;
            mask.w = 16;
            mask.h = 16;*/

            mask.w = 12;
            mask.h = 9;
            mask.offsetx = 2;
            mask.offsety = 15;

            solid = true;

            depth = -(y + mask.offsety);
        }
コード例 #2
0
        public override void init()
        {
            base.init();

            shadowGraphic = new bStamp(game.Content.Load<Texture2D>("shadow"));
            shadowGraphic.alpha = 0.4f;

            graphic = new bSpritemap(game.Content.Load<Texture2D>("hunter"), 16, 24);
            string[] names = {"s", "sw", "w", "nw",
                              "n", "ne", "e", "se"};

            // Add idle and walk animations
            int[][] frames = new int[][] { new int[] {  0,  1 }, new int[] {  8,  9 },
                                           new int[] { 16, 17 }, new int[] { 24, 25 },
                                           new int[] { 32, 33 }, new int[] { 40, 41 },
                                           new int[] { 48, 49 }, new int[] { 56, 57 } };

            int counter = 0;
            foreach (string name in names)
            {
                int[] tempFrames;

                // Idle animation
                tempFrames = new int[1];
                tempFrames[0] = frames[counter][0];
                graphic.add(new bAnim("idle-" + name, tempFrames, 0.0f));

                // Walk animation
                tempFrames = new int[frames[counter].Length];
                for (int i = 0; i < tempFrames.Length; i++)
                    tempFrames[tempFrames.Length - i - 1] = frames[counter][i];
                graphic.add(new bAnim("walk-" + name, tempFrames, 0.2f));

                counter++;
            }

            // Add attack animations
            for (int i = 0; i < frames.Length; i++)
            {
                graphic.add(new bAnim("fire-" + names[i], new int[1] { i * 8 + 2 }, 0.2f, false));
            }

            facing = "s";

            activeWeapon = new PlayerWeapon(game);

            graphic.play("idle-s");

            // Weapon holding related
            frameHotspots = parseFrameHotspots();
            weaponBehindPlayerDirectionList = new List<string>{"sw", "w", "nw", "n"};

            mask.w = 12;
            mask.h = 9;
            mask.offsetx = 2;
            mask.offsety = 15;

            state = PlayerState.Idle;
        }
コード例 #3
0
        public override void init()
        {
            base.init();

            mask.w = 16; mask.h = 15; mask.offsety = 1;
            _graphic = new bSpritemap(game.Content.Load<Texture2D>("beast"), 16, 16);
            int[] fs = {0, 1, 2, 3};
            _graphic.add(new bAnim("walk", fs, 0.12f));
            int[] fss = { 4, 5 };
            _graphic.add(new bAnim("carried", fss, 0.05f));

            _graphic.play("walk");

            moved = false;
            facing = (Dir) new Random().Next(2);
            hspeed = 1;
            vspeed = 0;
            gravity = 0.5f;

            isolated = false;

            attributes.Add("dynamic-solid");
        }
コード例 #4
0
        public override void init()
        {
            base.init();

            graphic = new bSpritemap(game.Content.Load<Texture2D>("worldchars"), 8, 8);
            int[] f = {0, 1};
            graphic.add(new bAnim("walk", f, 0.05f));
            graphic.play("walk");
        }