Esempio n. 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);



            Texture2D tempTexture = Content.Load <Texture2D>("ball");
            int       count       = 0;
            int       a           = 1400;
            int       rangee      = 7;
            int       colones     = 6;
            int       border      = 50;

            alive = a;
            List <Bloid> temp   = new List <Bloid>();
            Random       random = new Random();

            for (int j = 1; j < 6; j++)
            {
                for (int i = 0; i < a / 5; i++)
                {
                    temp.Add(new Bloid(screenRectangle.Width / rangee * j - 25, 3 * i + 100, (float)random.NextDouble() * 2 - 1, (float)random.NextDouble() * 2 - 1, tempTexture, screenRectangle));
                    count++;
                }
            }
            Sort(temp);
            font = Content.Load <SpriteFont>("myFont");

            obs         = new Obstacle[rangee * colones + 1];
            count       = 0;
            tempTexture = Content.Load <Texture2D>("Disaster");
            obs[count]  = new ControlledCube(tempTexture, new Vector2(0, 0));
            tempTexture = Content.Load <Texture2D>("CityBlock");
            count++;

            int r           = (screenRectangle.Width - border / 2 - tempTexture.Width);
            int c           = (screenRectangle.Height - border / 2 - tempTexture.Height);
            int ecartWidth  = tempTexture.Width + (screenRectangle.Width - tempTexture.Width * colones - border) / (colones - 1);
            int ecartHeight = tempTexture.Height + (screenRectangle.Height - tempTexture.Height * rangee - border) / (rangee - 1);

            for (int i = 0; i < colones; i++)
            {
                for (int j = 0; j < rangee; j++)
                {
                    obs[count] = new CityBlocks(tempTexture, new Vector2(r - ecartWidth * i, c - ecartHeight * j));

                    count++;
                }
            }

            StartGame();
        }
Esempio n. 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);

            Texture2D tempTexture = Content.Load<Texture2D>("ball");
            int count = 0;
            int a = 1400;
            int rangee = 7;
            int colones = 6;
            int border = 50;

            alive = a;
            List<Bloid> temp = new List<Bloid>();
            Random random = new Random();

            for (int j = 1; j < 6; j++)
            {
                for (int i = 0; i < a/5; i++)
                {
                    temp.Add(new Bloid(screenRectangle.Width / rangee * j-25,3*i+100, (float)random.NextDouble() * 2 - 1, (float)random.NextDouble() * 2 - 1, tempTexture, screenRectangle));
                    count++;
                }
            }
            Sort(temp);
            font = Content.Load<SpriteFont>("myFont");

            obs = new Obstacle[rangee * colones + 1];
            count = 0;
            tempTexture = Content.Load<Texture2D>("Disaster");
            obs[count] = new ControlledCube(tempTexture, new Vector2(0, 0));
            tempTexture = Content.Load<Texture2D>("CityBlock");
            count++;

            int r = (screenRectangle.Width - border/2 - tempTexture.Width);
            int c = (screenRectangle.Height - border/2 - tempTexture.Height);
            int ecartWidth = tempTexture.Width + (screenRectangle.Width - tempTexture.Width * colones - border)/(colones-1);
            int ecartHeight = tempTexture.Height + (screenRectangle.Height - tempTexture.Height * rangee - border) / (rangee - 1);
            for (int i = 0; i < colones; i++)
            {
                for (int j = 0; j < rangee; j++)
                {
                    obs[count] = new CityBlocks(tempTexture, new Vector2(r-ecartWidth*i, c-ecartHeight*j));

                    count++;
                }
            }

            StartGame();
        }