public Level(Game1 game) { actors = new List<Actor>(); actors.Add(new Actor(game,new Vector2(50,50),"Actors\\zombie_sheet", "White")); actors.ElementAt(0).ControlCharacter(); currentActor = actors.ElementAt(0); sanctuaryPos = new Vector2(279, 233); humans = new List<Human>(); this.game = game; switchSfx = game.Content.Load<SoundEffect>("Sfx\\switch"); zombieColors = new Color[] { Color.White, Color.Blue, Color.Red, Color.Green }; levelDesc = new byte[H,W] { {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0}, {0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0}, {0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0}, {0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0}, {0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0}, {0,0,0,1,0,0,0,0,0,RTL,RTR,0,0,0,0,0,0,1,0,0,0}, {0,0,0,1,0,0,0,0,0,RBL,RBR,0,0,0,0,0,0,1,0,0,0}, {0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0}, {0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0}, {0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0}, {0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0}, {0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, }; ground = new Ground[H, W]; this.Init(); }
/// <summary> /// The main entry point for the application. /// </summary> static void Main(string[] args) { using (Game1 game = new Game1()) { game.Run(); } }
public AnimatedSprite(Game1 game, String sprite, int FrameWidth, int delay) { this.animationTexture = game.Content.Load<Texture2D>(sprite); this.width = FrameWidth; this.height = 32; this.nPictures = (animationTexture.Width / FrameWidth); this.animationDelay = delay; }
public Menu(Game1 game) { menuFnt = game.Content.Load<SpriteFont>("Fonts\\MenuFont"); menuItemText = new string[] {"Start", "Instructions", "Quit" }; currentItem = 0; indicator = "->"; originalMenuText = menuItemText[0]; menuItemText[0] = indicator + menuItemText[0]; timer = 0; menuSfx = game.Content.Load<SoundEffect>("Sfx\\select"); logo = game.Content.Load<Texture2D>("Other\\Logo"); }
public Actor(Game1 game, Vector2 start, string spritepath, string name) { this.name = name; this.game = game; this.position = start; this.bounds = new Rectangle((int)start.X, (int)start.Y, 32/2, 32/2); this.animatedSpr = new AnimatedSprite(game, spritepath, 32, 100); this.isControlled = false; this.health = 100; ks = Keyboard.GetState(); color = Color.White; }
public Human(Game1 game, Vector2 pos, string sprPath) { int seed = unchecked(Environment.TickCount); rand = new Random(seed); this.position = pos; this.health = 20; animateSpr = new AnimatedSprite(game, sprPath, 32, 100); bloodAnim = new AnimatedSprite(game, "Other\\Blood", 32, 100); angle = 0; bounds = new Rectangle((int)position.X, (int)position.Y, animateSpr.getWidth()/2,animateSpr.getHeight()/2); healthBar = new Rectangle((int)position.X, (int)position.Y - 10, health, 2); isHit = false; isDead = false; isSafe = false; isFleeing = false; hpPieceSprite = game.Content.Load<Texture2D>("Other\\HealthBarPiece"); bloodSplash = game.Content.Load<Texture2D>("Other\\bloodSplash"); hurtsfx = game.Content.Load<SoundEffect>("Sfx\\hurt"); }
public Tile(Game1 game) { }
public StaticSprite(Game1 game, string sprite) { this.sprite = game.Content.Load<Texture2D>(sprite); }
public Ground(Game1 game, string sprPath, Vector2 pos, bool walkable) { this.position = pos; Ssprite = new StaticSprite(game, sprPath); this.walkable = walkable; }