示例#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);

            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();
        }
示例#2
0
 //public obstaclesScripts moveRods;
 // Start is called before the first frame update
 void Start()
 {
     Accessgravity = FindObjectOfType <PlayerController>();
     Quadmove      = FindObjectOfType <scrollingbackground>();
     Pspeed        = FindObjectOfType <parallaxMountain>();
     // PlayButton btn = PlayButton.GetComponent<Button>();
     // btn.onClick.AddListener(PlayGame);
     PlayButton.SetActive(true);
     namebutton.SetActive(true);
     Spawner.gameObject.SetActive(false);
     Panel.gameObject.SetActive(false);
     Backbutton.SetActive(false);
     Restartbutton.SetActive(false);
 }