Ejemplo n.º 1
0
 public Player(TileMap tileMap, 
               Texture2D towerTexture, 
               Texture2D projectileTexture, 
               Texture2D radiusTexture, 
               StartWaveButton startWaveButton,
               Texture2D hitpointBar,
               Vector2 hitpointBarPosition)
 {
     this.tileMap = tileMap;
     this.towerTexture = towerTexture;
     this.projectileTexture = projectileTexture;
     this.radiusTexture = radiusTexture;
     this.startWaveButton = startWaveButton;
     this.maxHitPoints = 100;
     this.currentHitPoints = maxHitPoints;
     this.hitpointBar = hitpointBar;
     this.hitpointBarPosition = hitpointBarPosition;
 }
Ejemplo n.º 2
0
 public EnemyWave(int waveCount, 
                  int enemyNumber,
                  EnemyPathing enemyPathing,
                  SpriteAnimator spriteAnimation, 
                  Player player,
                  StartWaveButton startWaveButton,
                  Texture2D hitpointBar, 
                  Vector2 hitpointBarPosition)
 {
     EnemyWave.waveCount = waveCount;
     this.enemyNumber = enemyNumber;
     this.enemyPathing = enemyPathing;
     this.spriteAnimation = spriteAnimation;
     this.player = player;
     this.startWaveButton = startWaveButton;
     this.hitpointBar = hitpointBar;
     this.hitpointBarPosition = hitpointBarPosition;
 }
Ejemplo n.º 3
0
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            //audio
            laserBlast = Content.Load<SoundEffect>("Audio/laserBlast");
            sound = new Sound(laserBlast);

            //music
            bgMusic = Content.Load<Song>("Audio/drMario");
            MediaPlayer.IsRepeating = true;

            //tile content
            Texture2D grass = Content.Load<Texture2D>("images/grass");
            Texture2D road = Content.Load<Texture2D>("images/road");

            //sets the tiles in order as numbers in the tiles array
            tileMap.tiles.Add(grass);
            tileMap.tiles.Add(road);

            //Fire Radius
            radiusTexture = Content.Load<Texture2D>("images/radius");

            //tower content
            Texture2D towerTexture = Content.Load<Texture2D>("images/tower");
            Texture2D projectileTexture = Content.Load<Texture2D>("images/laser");

            //Game Menu
            sideBar = Content.Load<Texture2D>("images/GUIstuff/menuBar");
            font = Content.Load<SpriteFont>("SpriteFonts/MoneyFont");
            menuBarPosition = new Vector2((graphics.PreferredBackBufferWidth - sideBar.Width), 0);
            menuBar = new MenuBar(sideBar, font, menuBarPosition);

            //Hitpoint Bar
            hitpointBar = Content.Load<Texture2D>("images/GUIstuff/healthBar");
            hitpointBarOverlay = Content.Load<Texture2D>("images/GUIstuff/healthBarOverlay");
            hitpointBarPosition.X = menuBarPosition.X + 125;
            hitpointBarPosition.Y = menuBarPosition.Y + 17;

            //Start Button
            startButton = Content.Load<Texture2D>("images/GUIstuff/startButton");
            buttonPosition = new Vector2(graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight);
            startWaveButton = new StartWaveButton(startButton, buttonPosition, Color.White);

            //player content
            player = new Player(tileMap, towerTexture, projectileTexture, radiusTexture, startWaveButton, hitpointBar, hitpointBarPosition);

            //bunny spriteSheet
            Texture2D bunnySheet = Content.Load<Texture2D>("images/bunnySheet");

            //enemy content
            Texture2D rabbitTexture = Content.Load<Texture2D>("images/rabbitEnemy2");
            rabbitAnimation = new SpriteAnimator(bunnySheet, new Point(5, 2));
            enemyWave = new EnemyWave(0, 10, pathing, rabbitAnimation, player, startWaveButton, hitpointBar, hitpointBarPosition);

            //Game State
            screenState = new GameState();
            startScreen = Content.Load<Texture2D>("images/ScreenStates/StartScreen");
            gameOverScreen = Content.Load<Texture2D>("images/ScreenStates/GameOverScreen");
            gameWinScreen = Content.Load<Texture2D>("images/ScreenStates/GameWinScreen");
        }