예제 #1
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            // TODO: use this.Content to load your game content here
            Texture2D grass  = Content.Load <Texture2D>("Block/grass");
            Texture2D path   = Content.Load <Texture2D>("Block/path");
            Texture2D pathLT = Content.Load <Texture2D>("Block/pathLT");
            Texture2D pathT  = Content.Load <Texture2D>("Block/pathT");
            Texture2D pathRT = Content.Load <Texture2D>("Block/pathRT");
            Texture2D pathL  = Content.Load <Texture2D>("Block/pathL");
            Texture2D pathR  = Content.Load <Texture2D>("Block/pathR");
            Texture2D pathLD = Content.Load <Texture2D>("Block/pathLD");
            Texture2D pathD  = Content.Load <Texture2D>("Block/pathD");
            Texture2D pathRD = Content.Load <Texture2D>("Block/pathRD");

            level.AddTexture(grass);// Add Block GPU
            level.AddTexture(path);
            level.AddTexture(pathLT);
            level.AddTexture(pathT);
            level.AddTexture(pathRT);
            level.AddTexture(pathL);
            level.AddTexture(pathR);
            level.AddTexture(pathLD);
            level.AddTexture(pathD);
            level.AddTexture(pathRD);
            Texture2D back = Content.Load <Texture2D>("Block/background");

            background.AddTexture(back);
            Texture2D enemyTexture = Content.Load <Texture2D>("Enemy/enemy1");

            //enemy1 = new Enemy(enemyTexture, Vector2.Zero, 100, 10, 1f);// change speed;
            //enemy1.SetWaypoints(level.Waypoints);
            waveManeger = new WaveManeger(level, 24, enemyTexture); // set wave
            Texture2D towerTexture  = Content.Load <Texture2D>("Tower/tower");
            Texture2D bulletTexture = Content.Load <Texture2D>("Tower/bullet");

            player = new Player(level, towerTexture, bulletTexture);
        }
예제 #2
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            // TODO: use this.Content to load your game content here
            Texture2D grass  = Content.Load <Texture2D>("Block/grass");
            Texture2D path   = Content.Load <Texture2D>("Block/path");
            Texture2D pathLT = Content.Load <Texture2D>("Block/pathLT");
            Texture2D pathT  = Content.Load <Texture2D>("Block/pathT");
            Texture2D pathRT = Content.Load <Texture2D>("Block/pathRT");
            Texture2D pathL  = Content.Load <Texture2D>("Block/pathL");
            Texture2D pathR  = Content.Load <Texture2D>("Block/pathR");
            Texture2D pathLD = Content.Load <Texture2D>("Block/pathLD");
            Texture2D pathD  = Content.Load <Texture2D>("Block/pathD");
            Texture2D pathRD = Content.Load <Texture2D>("Block/pathRD");

            level.AddTexture(grass);// Add Block GPU
            level.AddTexture(path);
            level.AddTexture(pathLT);
            level.AddTexture(pathT);
            level.AddTexture(pathRT);
            level.AddTexture(pathL);
            level.AddTexture(pathR);
            level.AddTexture(pathLD);
            level.AddTexture(pathD);
            level.AddTexture(pathRD);

            level2.AddTexture(grass);// level 2 texture
            level2.AddTexture(path);
            level2.AddTexture(pathLT);
            level2.AddTexture(pathT);
            level2.AddTexture(pathRT);
            level2.AddTexture(pathL);
            level2.AddTexture(pathR);
            level2.AddTexture(pathLD);
            level2.AddTexture(pathD);
            level2.AddTexture(pathRD);

            Texture2D tile    = Content.Load <Texture2D>("tile");
            Texture2D path3   = Content.Load <Texture2D>("Block/path");
            Texture2D pathLT3 = Content.Load <Texture2D>("Block/pathLT");
            Texture2D pathT3  = Content.Load <Texture2D>("Block/pathT");
            Texture2D pathRT3 = Content.Load <Texture2D>("Block/pathRT");
            Texture2D pathL3  = Content.Load <Texture2D>("Block/pathL");
            Texture2D pathR3  = Content.Load <Texture2D>("Block/pathR");
            Texture2D pathLD3 = Content.Load <Texture2D>("Block/pathLD");
            Texture2D pathD3  = Content.Load <Texture2D>("Block/pathD");
            Texture2D pathRD3 = Content.Load <Texture2D>("Block/pathRD");

            level3.AddTexture(tile);// level 2 texture
            level3.AddTexture(path3);
            level3.AddTexture(pathLT3);
            level3.AddTexture(pathT3);
            level3.AddTexture(pathRT3);
            level3.AddTexture(pathL3);
            level3.AddTexture(pathR3);
            level3.AddTexture(pathLD3);
            level3.AddTexture(pathD3);
            level3.AddTexture(pathRD3);


            Texture2D[] back = new Texture2D[]
            {
                Content.Load <Texture2D>("background")
            };
            background.AddTexture(back);
            Texture2D[] enemyTexture = new Texture2D[]
            {
                Content.Load <Texture2D>("Enemy/Elf1"),
                Content.Load <Texture2D>("Enemy/Elf2"),
                Content.Load <Texture2D>("Enemy/Elf3"),
                Content.Load <Texture2D>("Enemy/Elf4"),
                Content.Load <Texture2D>("Enemy/Elf5")
            };
            //enemy1 = new Enemy(enemyTexture, Vector2.Zero, 100, 10, 1f);// change speed;
            //enemy1.SetWaypoints(level.Waypoints);


            Texture2D[] towerTextures = new Texture2D[]
            {
                Content.Load <Texture2D>("Tower/tower"),
                Content.Load <Texture2D>("Tower/Slow"),
                Content.Load <Texture2D>("Tower/Snipe")
            };
            Texture2D bulletTexture = Content.Load <Texture2D>("Tower/bullet");

            player = new Player(level, towerTextures, bulletTexture);
            Texture2D healthTexture = Content.Load <Texture2D>("HP");

            // set number of wave
            waveManeger  = new WaveManeger(player, level, 16, enemyTexture, healthTexture);   // set wave1
            waveManeger2 = new WaveManeger2(player, level2, 20, enemyTexture, healthTexture); // set wave2
            Texture2D  topBar = Content.Load <Texture2D>("toolbar");
            SpriteFont font   = Content.Load <SpriteFont>("Arial");

            toolBar = new Toolbar(topBar, font, new Vector2(0, level.Height * 50));

            // The "Normal" texture for the arrow button.
            Texture2D arrowNormal = Content.Load <Texture2D>("Tower/tower");
            // The "MouseOver" texture for the arrow button.
            Texture2D arrowHover = Content.Load <Texture2D>("Tower/tower");
            // The "Pressed" texture for the arrow button.
            Texture2D arrowPressed = Content.Load <Texture2D>("Tower/tower");
            // The "Normal" texture for the spike button.
            Texture2D slowNormal = Content.Load <Texture2D>("Tower/Slow");
            // The "MouseOver" texture for the spike button.
            Texture2D slowHover = Content.Load <Texture2D>("Tower/Slow");
            // The "Pressed" texture for the spike button.
            Texture2D  slowPressed  = Content.Load <Texture2D>("Tower/Slow");
            Texture2D  snipeNormal  = Content.Load <Texture2D>("Tower/Snipe");
            Texture2D  snipeHover   = Content.Load <Texture2D>("Tower/Snipe");
            Texture2D  snipePressed = Content.Load <Texture2D>("Tower/Snipe");
            Texture2D  StartNormal  = Content.Load <Texture2D>("StartButtonPress");
            Texture2D  StartHover   = Content.Load <Texture2D>("StartButtonPress");
            Texture2D  StartPressed = Content.Load <Texture2D>("StartButtonNormal");
            SpriteFont font2        = Content.Load <SpriteFont>("Descrip");

            // SpriteFont text_data_wave = Content.Load<SpriteFont>("textFont/File");
            // Initialize the arrow button.
            arrowButton          = new Button(arrowNormal, arrowHover, arrowPressed, new Vector2(40, level.Height * 50 + 20), font2, "Arrow");
            arrowButton.Clicked += new EventHandler(arrowButton_Clicked);
            // Initialize the spike button.
            slowButton          = new Button(slowNormal, slowHover, slowPressed, new Vector2(120, level.Height * 50 + 20), font2, "Slow");
            slowButton.Clicked += new EventHandler(slowButton_Clicked);

            snipeButton          = new Button(snipeNormal, snipeHover, snipePressed, new Vector2(200, level.Height * 50 + 20), font2, "Snipe");
            snipeButton.Clicked += new EventHandler(snipeButton_Clicked);

            arrowButton.OnPress += new EventHandler(arrowButton_OnPress);
            slowButton.OnPress  += new EventHandler(slowButton_OnPress);
            snipeButton.OnPress += new EventHandler(snipeButton_OnPress);

            StartButton          = new Button(StartNormal, StartHover, StartPressed, new Vector2(375, 600), font2, "Start");
            StartButton.Clicked += new EventHandler(StartButton_Clicked);

            Stage1Button          = new Button(StartNormal, StartHover, StartPressed, new Vector2(100, 600), font2, "Stage1");
            Stage1Button.Clicked += new EventHandler(Stage1Button_Clicked);
            Stage2Button          = new Button(StartNormal, StartHover, StartPressed, new Vector2(400, 600), font2, "Stage2");
            Stage2Button.Clicked += new EventHandler(Stage2Button_Clicked);
            Stage3Button          = new Button(StartNormal, StartHover, StartPressed, new Vector2(700, 600), font2, "Stage3");
            Stage3Button.Clicked += new EventHandler(Stage3Button_Clicked);
        }
예제 #3
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            // TODO: use this.Content to load your game content here
            Texture2D grass  = Content.Load <Texture2D>("Block/grass");  //0
            Texture2D path   = Content.Load <Texture2D>("Block/path");   //1
            Texture2D pathLT = Content.Load <Texture2D>("Block/pathLT"); //2
            Texture2D pathT  = Content.Load <Texture2D>("Block/pathT");  //3
            Texture2D pathRT = Content.Load <Texture2D>("Block/pathRT"); //4
            Texture2D pathL  = Content.Load <Texture2D>("Block/pathL");  //5
            Texture2D pathR  = Content.Load <Texture2D>("Block/pathR");  //6
            Texture2D pathLD = Content.Load <Texture2D>("Block/pathLD"); //7
            Texture2D pathD  = Content.Load <Texture2D>("Block/pathD");  //8
            Texture2D pathRD = Content.Load <Texture2D>("Block/pathRD"); //9

            level.AddTexture(grass);                                     // Add Block GPU
            level.AddTexture(path);
            level.AddTexture(pathLT);
            level.AddTexture(pathT);
            level.AddTexture(pathRT);
            level.AddTexture(pathL);
            level.AddTexture(pathR);
            level.AddTexture(pathLD);
            level.AddTexture(pathD);
            level.AddTexture(pathRD);
            //Texture2D back = Content.Load<Texture2D>("Block/background");
            //background.AddTexture(back);
            Texture2D[] enemyTexture = new Texture2D[]
            {
                Content.Load <Texture2D>("Enemy/Elf1"),
                Content.Load <Texture2D>("Enemy/Elf2"),
                Content.Load <Texture2D>("Enemy/Elf3"),
                Content.Load <Texture2D>("Enemy/Elf4"),
                Content.Load <Texture2D>("Enemy/Elf5")
            };
            //enemy1 = new Enemy(enemyTexture, Vector2.Zero, 100, 10, 1f);// change speed;
            //enemy1.SetWaypoints(level.Waypoints);


            Texture2D[] towerTextures = new Texture2D[]
            {
                Content.Load <Texture2D>("Tower/tower"),
                Content.Load <Texture2D>("Tower/Slow"),
                Content.Load <Texture2D>("Tower/Snipe")
            };
            Texture2D bulletTexture = Content.Load <Texture2D>("Tower/bullet");

            player = new Player(level, towerTextures, bulletTexture);
            Texture2D healthTexture = Content.Load <Texture2D>("HP");

            waveManeger = new WaveManeger(player, level, 16, enemyTexture, healthTexture);// set wave
            Texture2D  topBar = Content.Load <Texture2D>("toolbar");
            SpriteFont font   = Content.Load <SpriteFont>("Arial");

            toolBar = new Toolbar(topBar, font, new Vector2(0, level.Height * 50));

            // The "Normal" texture for the arrow button.
            Texture2D arrowNormal = Content.Load <Texture2D>("Tower/tower");
            // The "MouseOver" texture for the arrow button.
            Texture2D arrowHover = Content.Load <Texture2D>("Tower/tower");
            // The "Pressed" texture for the arrow button.
            Texture2D arrowPressed = Content.Load <Texture2D>("Tower/tower");
            // The "Normal" texture for the spike button.
            Texture2D slowNormal = Content.Load <Texture2D>("Tower/Slow");
            // The "MouseOver" texture for the spike button.
            Texture2D slowHover = Content.Load <Texture2D>("Tower/Slow");
            // The "Pressed" texture for the spike button.
            Texture2D  slowPressed  = Content.Load <Texture2D>("Tower/Slow");
            Texture2D  snipeNormal  = Content.Load <Texture2D>("Tower/Snipe");
            Texture2D  snipeHover   = Content.Load <Texture2D>("Tower/Snipe");
            Texture2D  snipePressed = Content.Load <Texture2D>("Tower/Snipe");
            SpriteFont font2        = Content.Load <SpriteFont>("Descrip");

            // Initialize the arrow button.
            arrowButton          = new Button(arrowNormal, arrowHover, arrowPressed, new Vector2(40, level.Height * 50 + 20), font2);
            arrowButton.Clicked += new EventHandler(arrowButton_Clicked);
            // Initialize the spike button.
            slowButton          = new Button(slowNormal, slowHover, slowPressed, new Vector2(120, level.Height * 50 + 20), font2);
            slowButton.Clicked += new EventHandler(slowButton_Clicked);

            snipeButton          = new Button(snipeNormal, snipeHover, snipePressed, new Vector2(200, level.Height * 50 + 20), font2);
            snipeButton.Clicked += new EventHandler(snipeButton_Clicked);

            arrowButton.OnPress += new EventHandler(arrowButton_OnPress);
            slowButton.OnPress  += new EventHandler(slowButton_OnPress);
            snipeButton.OnPress += new EventHandler(snipeButton_OnPress);
        }