Esempio n. 1
0
        public GameOverScreen(Game1 game, SpriteBatch spriteBatch, AnimatedSprite Sp)
        {
            this.game = game;
            this.spriteBatch = spriteBatch;
            this.Sprite = Sp;

            spriteFont = game.Content.Load<SpriteFont>("menufont");
            image = game.Content.Load<Texture2D>("blood");
            string[] menuItems = { "Restart Game", "End Game" };
            menuComponent = new MenuComponent(game, spriteBatch, spriteFont, menuItems);
            game.Components.Add(menuComponent);
            imageRec = new Rectangle(0, 0, game.Window.ClientBounds.Width, game.Window.ClientBounds.Height);

            // Start Bat placement into list
            rand = new Random();

            for (int i = 0; i < 60; i++)
            {
                Bat b = new Bat(game, spriteBatch, Sprite);
                b.Position = new Vector2(400 + (float)(-50 + rand.NextDouble() * 100),
                                         200 + (float)(-50 + rand.NextDouble() * 100));
                b.speed = 20f + (float)rand.NextDouble() * 40.0f;
                ListOBats.Add(b);
                game.Components.Add(b);
            }
            for (int j = 0; j < 60; j++)
            {
                ListOBats[j].batList = ListOBats;
            }
            // end bat placement into list
        }
Esempio n. 2
0
 /// <summary>
 /// The main entry point for the application.
 /// </summary>
 static void Main(string[] args)
 {
     using (Game1 game = new Game1())
     {
         game.Run();
     }
 }
Esempio n. 3
0
 public Stalker(Game1 game, GameMode gm)
     : base(game)
 {
     // TODO: Construct any child components here
     Size = Vector3.One/4;
     Position = Vector3.Zero;
     _gameMode = gm;
     prevLens = gm.ActiveLens;
 }
Esempio n. 4
0
 public MenuComponent(Game1 game, SpriteBatch spriteBatch, SpriteFont spriteFont, string[] menuItems)
     : base(game)
 {
     // TODO: Construct any child components here
     this.game = game;
     this.spriteBatch = spriteBatch;
     this.spriteFont = spriteFont;
     this.menuItems = menuItems;
     MenuSize();
 }
Esempio n. 5
0
 public StartScreen(Game1 game, SpriteBatch spriteBatch)
 {
     this.game = game;
     this.spriteBatch = spriteBatch;
     spriteFont = game.Content.Load<SpriteFont>("menufont");
     image = game.Content.Load<Texture2D>("startmenubackground");
     string[] menuItems = { "Start Game", "Instructions", "End Game" };
     menuComponent = new MenuComponent(game, spriteBatch, spriteFont, menuItems);
     game.Components.Add(menuComponent);
     imageRec = new Rectangle(0, 0, game.Window.ClientBounds.Width, game.Window.ClientBounds.Height);
 }
Esempio n. 6
0
 public PauseScreen(Game1 game, SpriteBatch spriteBatch)
 {
     this.game = game;
     this.spriteBatch = spriteBatch;
     menuTitle = "Paused";
     spriteFont = game.Content.Load<SpriteFont>("menufont");
     image = game.Content.Load<Texture2D>("MenuBG");
     string[] menuItems = { "Resume Game", "Quit Game" };
     menuComponent = new MenuComponent(game, spriteBatch, spriteFont, menuItems);
     game.Components.Add(menuComponent);
     imageRec = new Rectangle(0, 0, game.Window.ClientBounds.Width, game.Window.ClientBounds.Height);
 }
Esempio n. 7
0
 public Instructions(Game1 game, SpriteBatch spriteBatch)
 {
     this.game = game;
     this.spriteBatch = spriteBatch;
     menuTitle = "Instructions";
     spriteFont = game.Content.Load<SpriteFont>("menufont");
     image = game.Content.Load<Texture2D>("MenuBG");
     string[] menuItems = { "Back to Menu" };
     menuComponent = new MenuComponent(game, spriteBatch, spriteFont, menuItems);
     game.Components.Add(menuComponent);
     menuComponent.Position = new Vector2(game.Window.ClientBounds.Width - game.Window.ClientBounds.Width / 4 , 50);
     imageRec = new Rectangle(0, 0, game.Window.ClientBounds.Width, game.Window.ClientBounds.Height);
 }
Esempio n. 8
0
        public LevelComponent(Game1 game, GameMode gameMode, string wallsFile)
            : base((Game)game)
        {
            this.gameMode = gameMode;
            WallsFile = wallsFile;
            System.IO.Stream stream = TitleContainer.OpenStream(wallsFile);
            XDocument doc = XDocument.Load(stream);

            Walls = ReadWalls(doc);
            Coins = ReadCoins(doc);
            Traps = ReadTraps(doc);

            Goal = ReadGoal(doc);
        }
Esempio n. 9
0
        public GameMode(Game1 game)
        {
            this.game = game;

            ActiveLens = null;
            RedLens = new RedLens(game, this);
            GreenLens = new GreenLens(game, this);
            BlueLens = new BlueLens(game, this);
            Stalker = new Stalker(game, this);
            //Player = new Player(game, new Vector3(1, 0, -4), new Vector3(2.2f, 1, 2.2f), 1, 270);
            Player = new Player(game, new Vector3(0, 1, 0), new Vector3(1.5f, 1, 1.5f), 1, 270);
            game.Components.Add(Player);
            game.Components.Add(RedLens);
            game.Components.Add(GreenLens);
            game.Components.Add(BlueLens);

            game.Components.Add(Stalker);

            hud = new HUD(game, this);
            game.Components.Add(hud);

            sound = new Sounds(game, this);
            game.Components.Add(sound);

            levels.Add(new Level01(game, this));
            ActiveLevel = levels.First();

            foreach (Coin coin in ActiveLevel.Coins)
            {
                game.Components.Add(coin);
            }

            foreach (Wall wall in ActiveLevel.Walls)
            {
                game.Components.Add(wall);
            }

            foreach (Trap trap in ActiveLevel.Traps)
            {
                game.Components.Add(trap);
            }
            game.Components.Add(ActiveLevel.Goal);
        }
Esempio n. 10
0
 public Level01(Game1 game, GameMode gameMode)
     : base(game, gameMode, "Content\\level_01.xml")
 {
 }