Beispiel #1
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()
        {
            ListObject.HEIGHT = HEIGHT;
            ListObject.WIDTH  = WIDTH;

            this.IsMouseVisible = true;
            // TODO: Add your initialization logic here



            ListObject.InitialiseMonde();

            Window.Title = "PingouinGame";
            base.Initialize();
        }
Beispiel #2
0
        /// <summary>
        /// Allows the game to run logic such as updating the world,
        /// checking for collisions, gathering input, and playing audio.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Update(GameTime gameTime)
        {
            // TODO: Add your update logic here

            base.Update(gameTime);

            graphics.PreferredBackBufferWidth  = WIDTH;
            graphics.PreferredBackBufferHeight = HEIGHT;


            if (ListObject.MesMob.Count == 0)
            {
                ListObject.AppartionMob();
            }

            ListObject.player.UpdateFrame(gameTime);
            if (!ListObject.player.Affichage)
            {
                ListObject.player.Move(Keyboard.GetState(), HEIGHT, WIDTH);
            }

            ListObject.player.Action(Keyboard.GetState());

            ListObject.RemoveEntity();

            foreach (Shot item in ListObject.MesTires)
            {
                item.isTouche(HEIGHT, WIDTH);
                item.Move();
            }
            foreach (Boum item in ListObject.MesBoum)
            {
                item.UpdateFrame(gameTime);
            }
            foreach (Mob elem in ListObject.MesMob)
            {
                elem.IsDead();
                elem.UpdateFrame(gameTime);
                //elem.Tape(gameTime);
                if (elem.Type == 1)
                {
                    elem.Move(rand.Next(0, 5), HEIGHT, WIDTH);
                }
            }
        }