Esempio n. 1
0
 //overload constructor for animation
 public Sprite(SpriteAnimator spriteAnimation, Vector2 position)
 {
     this.spriteAnimation = spriteAnimation;
     this.spritePosition = position;
     this.spriteSource = new Vector2(54 / 2, 54 / 2);
     this.spriteCenter = new Vector2((position.X + 54) / 2,
                                (position.Y + 54) / 2);
 }
Esempio n. 2
0
 //overload contstructor
 public Enemy(SpriteAnimator spriteAnimation, Vector2 position, float health, int money, float speed)
     : base(spriteAnimation, position)
 {
     Enemy.enemySpeed = speed;
     this.enemyHealth = health;
     this.presentHealth = enemyHealth;
     this.money = money;
     this.spriteAnimation = spriteAnimation;
 }
Esempio n. 3
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;
 }
Esempio n. 4
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");
        }