コード例 #1
0
ファイル: Game1.cs プロジェクト: ma7modx/aliens-attack-game
        /// <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.
            sound   = Content.Load <Song>("music//AC2_Ezios_Family");
            content = Content;

            graphicsdevice = GraphicsDevice;
            spriteBatch    = new SpriteBatch(GraphicsDevice);

            textpause  = Content.Load <Texture2D>("pause");
            pausedRect = new Rectangle(0, 0, textpause.Width, textpause.Height);

            font     = Content.Load <SpriteFont>("SpriteFont1");
            fot3     = Content.Load <SpriteFont>("font3");
            Airplane = new MainPlane();

            // enm = new Enemies("Images//asteroid", new Vector2(20, 20), 5, 0 , new Vector2(500,500) );
            movingBackGround = new Background("Images//stars", -1200);
            constBackGround  = new Background("Images//Lion-Space-Wallpaper", 0);

            fire         = new Fire("Images//asteroid", new Vector2(20, 20), 20, 20);
            bulleteffect = Content.Load <SoundEffect>("music//playershoot1");
            Events.loadContent();


            // TODO: use this.Content to load your game content here
        }
コード例 #2
0
        public static void FiresUpdate(ref List <Fire> bullets, MainPlane versus)// collision between all anemies fires and Plane
        {
            for (int x = 0; x < bullets.Count; ++x)
            {
                Fire fire = bullets[x];

                if (Events.pixelCollesion(versus.texturesCollection[versus.StandardImgFrame], fire.texturesCollection[fire.StandardImgFrame], new Vector2((float)versus.cordx, (float)versus.cordy), new Vector2((float)fire.cordx, (float)fire.cordy)))
                {
                    fire.Exist     = false;
                    Events.health -= 20;
                }

                if (fire.OutOfBorders(fire.width, fire.height) || !fire.Exist) // delete
                {
                    bullets.Remove(fire);
                    fire.Exist = false;
                    x--;
                }
                else // update
                {
                    fire.Update();
                }
            }
        }