Example #1
0
        public void Intesects(Ufo ufo)
        {
            if (!ufo.die)
            {
                Ufo ufoDie = new Ufo(Game, ufo);
                Game.Components.Add(ufoDie);
            }

            Game.Components.Remove(ufo);
        }
Example #2
0
        public Ufo(Game game, Ufo ufo)
            : base(game)
        {
            base.texture = ufo.texture;
            this.frameSize = new Point(64, 64);
            this.currentFrame = ufo.currentFrame;
            this.position = ufo.position;
            this.sheetSize = new Point(MAXSHEETSIZE, 0);
            this.visible = true;
            this.enable = true;
            this.die = true;
            this.collisionOffset = new Point(2, 7);

            this.millisecondsPerFrame = 60;
            random = new Random((int)(DateTime.Now.Ticks));//this.GetHashCode());
        }
Example #3
0
        public Ufo(Game game, Ufo ufo)
            : base(game)
        {
            base.texture         = ufo.texture;
            this.frameSize       = new Point(64, 64);
            this.currentFrame    = ufo.currentFrame;
            this.position        = ufo.position;
            this.sheetSize       = new Point(MAXSHEETSIZE, 0);
            this.visible         = true;
            this.enable          = true;
            this.die             = true;
            this.collisionOffset = new Point(2, 7);

            this.millisecondsPerFrame = 60;
            random = new Random((int)(DateTime.Now.Ticks));//this.GetHashCode());
        }
Example #4
0
        private void UfoBonusYes()
        {
            List<Background> listBack = new List<Background>();
            foreach (GameComponent gc in Components)
                if (gc is Background)
                {
                    listBack.Add((Background)gc);
                }

            foreach (Background bg in listBack)
                Components.Remove(bg);
            backgoundManager.LoadPixelBackgroud();
            ufoBonus = false;
            Components.Add(ufo = new Ufo(this, ref ufo_t));
            ufo.PutinStartPosition();
        }
Example #5
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            #region ISWIDESCREEN
            if (!GraphicsAdapter.DefaultAdapter.IsWideScreen)
            {
                if (graphics.GraphicsDevice.DisplayMode.AspectRatio == 1.25f)
                {
                    ASPECTHD = 16.0f / 9.0f;
                    ASPECTSD = 5f / 4f;
                    ASPECTWIDTHRATIO = 1280f / 1280f;
                    ASPECTHEIGHTRATIO = 1024f / 720f;
                    ASPECTRATIO = ASPECTSD / ASPECTHD;
                    VIEWPORTHEIGHT = 720f;
                    VIEWPORTWIDTH = 1280f;
                }
                else
                {
                    ASPECTHD = 16.0f / 9.0f;
                    ASPECTSD = 4f / 3f;
                    ASPECTWIDTHRATIO = 1024f / 1280f;
                    ASPECTHEIGHTRATIO = 1024f / 720f;
                    ASPECTRATIO = ASPECTSD / ASPECTHD;
                    VIEWPORTHEIGHT = 720f;
                    VIEWPORTWIDTH = 1280;
                }

            }
            #endregion

            #region BACKGROUND
            tileMap = Content.Load<Texture2D>(@"Barrier\" + nameTileMap);
            backgoundManager = new BackgroundPixelManager(this, ref tileMap, screen);
            Components.Add(backgoundManager);
            #endregion

            #region TANK
            tank = Content.Load<Texture2D>(@"Tank\" + nameTank);
            player = new Tank(this, ref tank, screen);
            Components.Add(player);
            player.PutinStartPosition();
            #endregion

            #region INVASOR
            invasor = Content.Load<Texture2D>(@"Invasors\" + nameInvasor);
            invasorsManager = new InvasorsManager(this, ref invasor, difficult.normal.ToString());
            Components.Add(invasorsManager);
            #endregion

            #region UFO
            ufo_t = Content.Load<Texture2D>(@"Ufo\" + "ufo_sheet");
            ufo = new Ufo(this, ref ufo_t);
            Components.Add(ufo);
            ufo.PutinStartPosition();
            #endregion

            #region PENTAGRAM
            pentagam_sheet = Content.Load<Texture2D>(@"Pentagram\pentagram_sheet");
            pentagramP1 = new Pentagram(this, ref pentagam_sheet, Vector2.Zero);
            pentagramP2 = new Pentagram(this, ref pentagam_sheet, new Vector2(1280 - 120,0));
            Components.Add(pentagramP1);
            Components.Add(pentagramP2);
            #endregion

            base.Initialize();
        }
Example #6
0
        public void Intesects(Ufo ufo)
        {
            if (!ufo.die)
            {
                ufo.moveEffect.Stop();
                Ufo ufoDie = new Ufo(Game, ufo);
                Game.Components.Add(ufoDie);
            }

            Game.Components.Remove(ufo);
        }