Example #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);

            background = new graphics2d(Content, "fullmoon", displaywidth, displayheight);
            gameoverimage = new graphics2d(Content, "gameover", displaywidth, displayheight);

            for (int i = 0; i < numberofballs; i++)
            {
                float tempsize = (float)(randomiser.Next(100) + 1) * ballsizeratio;
                if (tempsize < miniballsize) tempsize = miniballsize;

                balls[i] = new sprites2d(Content, "ast1", displaywidth / 2, displayheight / 2, tempsize,
                    new Color((byte)randomiser.Next(255), (byte)randomiser.Next(255), (byte)randomiser.Next(255)), true, randomiser);
            }
            collidesound = Content.Load<SoundEffect>("rocks");
            soundtrack1 = Content.Load<SoundEffect>("explosive_attack");
            music1 = soundtrack1.CreateInstance();
            music1.IsLooped = true;
            music1.Volume = 0.5f;
            soundtrack2 = Content.Load<SoundEffect>("iron-man");
            music2 = soundtrack2.CreateInstance();
            music2.IsLooped = true;
            music2.Volume = 0.5f;
            mainfont = Content.Load<SpriteFont>("quartz4");



            reset();
        }
Example #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);

            if (File.Exists(@"highscore.txt"))
            {
                String line;
                StreamReader sr = new StreamReader(@"highscore.txt");
                line = sr.ReadLine();
                sr.Close();
                line = line.Trim();
                for (int i = 0; i < numberofhighscores; i++)
                    highscore[i] = (int)Convert.ToDecimal(line);

            }

            cameraposition = new Vector3(1000, 100, 10);
            cameralookat = new Vector3(0, 400, 0);
            aspectratio = (float)displaywidth / (float)displayheight;

            ground = new staticmesh(Content, "sground", 100f, new Vector3(0, -40, 0), new Vector3(0, 0, 0));
            robot = new model3d(Content, "r2d2v2", 2f, new Vector3(1000, 0, 1000), new Vector3(0, 0, 0), 0.05f, 0.5f, 10);

            for (int i = 0; i < numberoftrees; i++)
            {
                if (i % 2 == 0)
                    trees[i] = new staticmesh(Content, "tree", (float)(randomiser.Next(20) + 1) / 10,
                        new Vector3(randomiser.Next(6000) - 3000, 0, randomiser.Next(6000) - 3000),
                        new Vector3(0, randomiser.Next(7), 0));
                else
                {
                    trees[i] = new staticmesh(Content, "lamppost", (float)(randomiser.Next(20) + 1) / 3,
                        new Vector3(randomiser.Next(6000) - 3000, 0, randomiser.Next(6000) - 3000),
                        new Vector3(0, randomiser.Next(70), 0));

                    trees[i].position.Y = trees[i].size * 40;
                }
            }

            background = new graphics2d(Content, "Background for Menus", displaywidth, displayheight);
            mousepointer1 = new sprites2d(Content, "X-Games-Cursor", 0, 0, 0.15f, Color.White, true, randomiser);
            mousepointer2 = new sprites2d(Content, "X-Games-Cursor-Highlight", 0, 0, 0.15f, Color.White, true,randomiser);

            menuoptions[0, 0] = new sprites2d(Content, "Start-Normal", displaywidth / 2, 200, 1, Color.White, true,randomiser);
            menuoptions[0, 1] = new sprites2d(Content, "Start-Selected", displaywidth / 2, 200, 1,Color.White, true,randomiser);
            menuoptions[1, 0] = new sprites2d(Content, "Options-Normal", displaywidth / 2, 300, 1, Color.White, true,randomiser);
            menuoptions[1, 1] = new sprites2d(Content, "options-Selected", displaywidth / 2, 300, 1, Color.White, true,randomiser);
            menuoptions[2, 0] = new sprites2d(Content, "High-Score-Normal", displaywidth / 2, 400, 1, Color.White, true,randomiser);
            menuoptions[2, 1] = new sprites2d(Content, "High-Score-Selected", displaywidth / 2, 400, 1, Color.White, true,randomiser);
            menuoptions[3, 0] = new sprites2d(Content, "Exit-Normal", displaywidth / 2, 500, 1, Color.White, true,randomiser);
            menuoptions[3, 1] = new sprites2d(Content, "Exit-Selected", displaywidth / 2, 500, 1, Color.White, true,randomiser);

            for (int i = 0; i < numberofoptions; i++)
                menuoptions[i, 0].updateobject();

            mainfont = Content.Load<SpriteFont>("mainfont");
        }
Example #3
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);

            background = new graphics2d(Content, "fullmoon", displaywidth, displayheight);
            gameoverimage = new graphics2d(Content, "gameover", displaywidth, displayheight);

            football = new sprites2d(Content, "football2", displaywidth / 2, displayheight / 2, 0.2f, Color.Tomato, true);
            football2 = new sprites2d(Content, "football2", 100, 100, 0.2f, Color.White, true);
            mainfont = Content.Load<SpriteFont>("quartz4");

            reset();
        }
Example #4
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);

            backgscroll = new scrollingbackground(Content, "space", 1, 5, 5);
            gameoverimage = new graphics2d(Content, "gameover", displaywidth, displayheight);

            for (int i = 0; i < numberofballs; i++)
            {
                float tempsize = (float)(randomiser.Next(100) + 1) * ballsizeratio;
                if (tempsize < miniballsize) tempsize = miniballsize;

                balls[i] = new sprites2d(Content, "ast1", displaywidth / 2, displayheight / 2, tempsize,
                    new Color((byte)randomiser.Next(255), (byte)randomiser.Next(255), (byte)randomiser.Next(255)), true, randomiser);
            }
            collidesound = Content.Load<SoundEffect>("rocks");
            soundtrack1 = Content.Load<SoundEffect>("explosive_attack");
            music1 = soundtrack1.CreateInstance();
            music1.IsLooped = true;
            music1.Volume = 0.5f;
            soundtrack2 = Content.Load<SoundEffect>("iron-man");
            music2 = soundtrack2.CreateInstance();
            music2.IsLooped = true;
            music2.Volume = 0.5f;
            mainfont = Content.Load<SpriteFont>("quartz4");

            for (int i = 0; i < numberofballs; i++)
            {
                explosion[i] = new animation(Content, "effect_005", 0, 0, 1f, Color.White, false, 24, 4, 5, false);
            }

            shiphit[0] = new animation(Content, "effect_003", 0, 0, 1, Color.White, false, 24, 5, 5, false);
            shiphit[1] = new animation(Content, "effect_002", 0, 0, 1, Color.White, false, 24, 4, 5, false);

            bullet[0] = new ammo(Content, "bullet1", 0, 0, .1f, Color.White, false);
            bullet[1] = new ammo(Content, "bullet2", 0, 0, .1f, Color.White, false);

            for (int b = 0; b < numberofbullets; b++)
                for (int s = 0; s < numberofships; s++)

                    bullets5[s, b] = new ammo(Content, "bullet2", 0, 0, .1f, Color.White, false);

            reset();
        }
Example #5
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);

            if (File.Exists(@"highscore.txt"))
            {
                String line;
                StreamReader sr = new StreamReader(@"highscore.txt");
                line = sr.ReadLine();
             
                line = line.Trim();
                for (int i = 0; i < numberofhighscores &! sr.EndOfStream; i++)
                    highscores[i] = Convert.ToInt32(line);

                sr.Close();
            }

            background = new graphics2d(Content, "Background for Menus", displaywidth, displayheight);
            mousepointer1 = new sprites2d(Content, "X-Games-Cursor", 0, 0, 0.15f, Color.White, true, randomiser);
            mousepointer2 = new sprites2d(Content, "X-Games-Cursor-Highlight", 0, 0, 0.15f, Color.White, true,randomiser);

            menuoptions[0, 0] = new sprites2d(Content, "Start-Normal", displaywidth / 2, 200, 1, Color.White, true,randomiser);
            menuoptions[0, 1] = new sprites2d(Content, "Start-Selected", displaywidth / 2, 200, 1,Color.White, true,randomiser);
            menuoptions[1, 0] = new sprites2d(Content, "Options-Normal", displaywidth / 2, 300, 1, Color.White, true,randomiser);
            menuoptions[1, 1] = new sprites2d(Content, "options-Selected", displaywidth / 2, 300, 1, Color.White, true,randomiser);
            menuoptions[2, 0] = new sprites2d(Content, "High-Score-Normal", displaywidth / 2, 400, 1, Color.White, true,randomiser);
            menuoptions[2, 1] = new sprites2d(Content, "High-Score-Selected", displaywidth / 2, 400, 1, Color.White, true,randomiser);
            menuoptions[3, 0] = new sprites2d(Content, "Exit-Normal", displaywidth / 2, 500, 1, Color.White, true,randomiser);
            menuoptions[3, 1] = new sprites2d(Content, "Exit-Selected", displaywidth / 2, 500, 1, Color.White, true,randomiser);

            for (int i = 0; i < numberofoptions; i++)
                menuoptions[i, 0].updateobject();

            mainfont = Content.Load<SpriteFont>("mainfont");

        }