Ejemplo n.º 1
0
        /// <summary>
        /// Place obsticles on the map based on the difficulty
        /// </summary>
        /// <param name="obsticle"></param>
        /// <returns></returns>
        public int placeObsticles(Obsticle obsticle)
        {
            //if easy
            if (Difficulty.s_difficultyChoice == 1)
            {
                //set the max length equal to 1/4 of height of map
                double modifier = _map.ActualHeight / 4;
                int    easy     = (int)modifier;
                //set the obsticle height to a random value
                int _obstHeight = _randomizer.Next(easy);
                obsticle.createSize(50, _obstHeight);
                //set the start location of the obsticles
                obsticle.setLocation(0, 0);
                //return obsticle height
                return(_obstHeight);
            }
            //if medium
            else if (Difficulty.s_difficultyChoice == 2)
            {
                //set the max length equal to 1/3 of height of map
                double modifier = _map.ActualHeight / 3;
                int    medium   = (int)modifier;
                //set the obsticle height to a random value
                int _obstHeight = _randomizer.Next(medium);
                obsticle.createSize(50, _obstHeight);
                //set the start location of the obsticles
                obsticle.setLocation(0, 0);
                //return obsticle height
                return(_obstHeight);
            }
            //if hard
            else if (Difficulty.s_difficultyChoice == 3)
            {
                //set the max length equal to 1/2 of height of map +/- height of hoothoot

                double modifier = (_map.ActualHeight / 2) - 40;
                int    hard     = (int)modifier;
                //set the obsticle height to a random value

                int _obstHeight = _randomizer.Next(hard);
                obsticle.createSize(50, _obstHeight);
                //set the start location of the obsticles

                obsticle.setLocation(0, 0);
                //return obsticle height
                return(_obstHeight);
            }

            return(_obstHeight);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Places the obsticles that appear on the bottom onto the map
        /// </summary>
        public void createBottomObsticles()
        {
            //value defaulted to zero
            int value = 0;

            //place all the obsticles in obsticleList
            foreach (Obsticle obsticle in _obsticleOnBottomList)
            {
                //get the height of obsticles to place pipe tops
                double height = placeObsticles(obsticle);
                //flip obstilce
                obsticle.getObsticle.RenderTransformOrigin = new Point(1, 1);
                ScaleTransform flipObsticle = new ScaleTransform();
                flipObsticle.ScaleY = -1;
                //set the location of the obsticle
                int left = Difficulty.s_obsticleDistance * value + 500;
                obsticle.setLocation(left, _map.ActualHeight - (obsticle.getObsticle.ActualHeight));
                value++;
                //create pipe tops
                _bottomPipeTops = new Obsticle(_canvas, _hoothoot);
                _bottomPipeTops.createSize(75, 30);
                _bottomPipeTops.setLocation(left - 12.5, _map.ActualHeight - height);
                //flip pipe tops
                _bottomPipeTops.getObsticle.RenderTransformOrigin = new Point(1, 1);
                ScaleTransform flipPipeTop = new ScaleTransform();
                flipPipeTop.ScaleY = -1;
                //add pipe tops to pipeTopList
                _bottomPipeTopsList.Add(_bottomPipeTops);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Place the obsticle that appear on top onto the map
        /// </summary>
        public void createTopObsticles()
        {
            //value defaulted to zero
            int value = 0;

            //place all the obsticles in obsticleList
            foreach (Obsticle obsticle in _obsticleOnTopList)
            {
                //get the height of obsticles to place pipe tops
                double height = placeObsticles(obsticle);
                //set the location of the obsticle
                int left = Difficulty.s_obsticleDistance * value + 500;
                obsticle.setLocation(left, 0);
                value++;
                //create pipe tops
                _topPipeTops = new Obsticle(_canvas, _hoothoot);
                _topPipeTops.createSize(75, 30);
                _topPipeTops.setLocation(left - 12.5, height);
                //add pipe tops to pipeTopList
                _topPipeTopsList.Add(_topPipeTops);
            }
        }