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; }
public override void init() { base.init(); graphic = new bSpritemap(game.Content.Load<Texture2D>("door"), 16, 34); graphic.add(new bAnim("closed-front", new int[]{0})); graphic.add(new bAnim("open-front", new int[]{1})); graphic.add(new bAnim("closed-side", new int[]{1})); graphic.add(new bAnim("open-side", new int[]{0})); graphicPosition.Add("closed-front", new Vector2(0, 1)); graphicPosition.Add("open-front", new Vector2(1, 2)); graphicPosition.Add("closed-side", new Vector2(0, 2)); graphicPosition.Add("open-side", new Vector2(0, 12)); open = false; }
public PlayerWeapon(bGame game) { this.game = game; hotspots = new Dictionary<string, List<Point>>(); string weaponName = "mace"; // Read file Queue<string> lines = readFile("Assets/" + weaponName + ".cfg"); // Begin actual parsing // Fetch sheet general info int animationsCount, width, height; string[] lineValues = lines.Dequeue().Split(new char[]{' '}); if (lineValues.Length < 3) throw new Exception("Couldn't parse sheet general info line"); animationsCount = int.Parse(lineValues[0]); width = int.Parse(lineValues[1]); height = int.Parse(lineValues[2]); // Create graphic with read parameters graphic = new bSpritemap(game.Content.Load<Texture2D>(weaponName), width, height); // Fetch and create animations for (int i = 0; i < animationsCount; i++) { Pair<bAnim, List<Point>> parseResult = parseAnimation(lines); bAnim anim = parseResult.first; if (anim == null) throw new Exception("Could't parse animation " + i + " of " + animationsCount); else { hotspots[anim.name] = parseResult.second; graphic.add(anim); } } }
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); }
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"); }
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"); }