Example #1
0
        //Pre: None
        //Post: A new wave is added
        //Description: Subprogram to add a new wave
        private static void AddWave()
        {
            //Int variables to hold number of each enemy for the new wave
            int newKnightNo;
            int newArcherNo;
            int newBanditNo;
            int newSkeletonNo;
            int newGoblinNo;
            int newPrinceNo;
            int newWizardNo;
            int newFairyNo;
            int newWitchNo;
            int newDragonNo;

            //Getting number of each enemy as a function of wave number
            newKnightNo   = (int)Math.Ceiling(15 * Math.Log10(currentWaveNo) + 10);
            newArcherNo   = (int)Math.Ceiling(18 * Math.Log10(currentWaveNo) + 5);
            newBanditNo   = (int)Math.Ceiling(12 * Math.Log10(currentWaveNo) - 5);
            newSkeletonNo = (int)Math.Ceiling(4 * Math.Sqrt(currentWaveNo * 0.8) + 5);
            newGoblinNo   = (int)Math.Ceiling(10 * Math.Sin(0.5 * (currentWaveNo - 5)) + 5 + 0.05 * currentWaveNo);
            newPrinceNo   = (int)Math.Ceiling(0.8 * currentWaveNo - 11);
            newWizardNo   = (int)Math.Ceiling(0.5 * currentWaveNo - 7);
            newFairyNo    = (int)Math.Ceiling(8 * Math.Log10(2 * currentWaveNo) - 11);
            newWitchNo    = (int)Math.Ceiling(0.6 * currentWaveNo - 11);
            newDragonNo   = (int)(0.15 * currentWaveNo - 2);

            //Resetting wave
            currentWave = new Enemies.Wave(newKnightNo, newArcherNo, newBanditNo, newSkeletonNo, newGoblinNo, newPrinceNo, newWizardNo, newFairyNo, newWitchNo, newDragonNo);
        }
Example #2
0
        //Pre: None
        //Post: Various game components are reset
        //Description: Subprogram to hold reset logic for various game components
        public static void Reset()
        {
            //Resetting current wave and wave number
            currentWaveNo = 1;
            currentWave   = new Enemies.Wave(0, 0, 0, 0, 0, 0, 0, 0, 0, 0);

            //Resetting game state and speed to not running
            currentGameState = WAVE_ENDED;
            currentSpeed     = 1;
            Main.Instance.SetFrameRate(60.0f);
        }
Example #3
0
        //Pre: 'Content', the content manager required to load content
        //Post: Various game logic components are loaded and set up
        //Description: Subprogram to load and set up various game logic components
        public static void Load(ContentManager Content)
        {
            //Importing game screen button images and setting up rectangles
            for (int i = 0; i < 3; i++)
            {
                gameStateButtonImg[i] = Content.Load <Texture2D>("Images/Sprites/Buttons/gameButton" + (i + 1));
            }
            gameStateButtonRect = new Rectangle(660, 512, 130, 35);

            //Importing fonts
            gameLogicFont  = Content.Load <SpriteFont>("Fonts/GameLogicFont");
            gameStatusFont = Content.Load <SpriteFont>("Fonts/GameStatusFont");

            //Importing soundeffects and setting up instances
            winSnd         = Content.Load <SoundEffect>("Audio/SoundEffects/waveWin");
            winSndInstance = winSnd.CreateInstance();

            //Setting a default blank wave
            currentWave = new Enemies.Wave(0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
        }