示例#1
0
文件: Level.cs 项目: henrydm/PacMan
        public Level()
        {
            _pacman = new AnimatedObject(5);
            _pacman.AddGeoemtry(Serialized.Meshes.Game.Pac_Man, Settings.MaterialYellow);
            _pacman.AddGeoemtry(Serialized.Meshes.Game.Pac_Man_Eyes, Settings.MaterialBlack);

            _gohsts  = new List<AutoAnimatedObject>();

            var blinky = new AutoAnimatedObject(1);
            blinky.AddGeoemtry(Serialized.Meshes.Game.Ghost_Body,Settings.MaterialRed);
            blinky.AddGeoemtry(Serialized.Meshes.Game.Ghost_Mouth, Settings.MaterialBlack);
            blinky.AddGeoemtry(Serialized.Meshes.Game.Clyde_Eyes, Settings.MaterialRed);
            _gohsts.Add(blinky);

            var pinky = new AutoAnimatedObject(1);
            pinky.AddGeoemtry(Serialized.Meshes.Game.Ghost_Body, Settings.MaterialRed);
            pinky.AddGeoemtry(Serialized.Meshes.Game.Ghost_Mouth, Settings.MaterialBlack);
            pinky.AddGeoemtry(Serialized.Meshes.Game.Clyde_Eyes, Settings.MaterialRed);
            _gohsts.Add(pinky);

            //_maze = new Maze(Serialized.Meshes.Game.Maze1,Set);
            //_pacman = new GameObject(Serialized.Meshes.Game.Pacman);
            //_gohsts = new List<GameObject>(4);
            // PointInfo.LoadPoints(Serialized.Locations.BallPoints.test);
        }
示例#2
0
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);
            //  changing the back buffer size changes the window size (when in windowed mode)
            graphics.PreferredBackBufferWidth  = 1024;
            graphics.PreferredBackBufferHeight = 660;
            graphics.ApplyChanges();

            // Loding wall, bean and bigBean objects
            wall    = new AnimatedObject(Content.Load <Texture2D>("mur"), new Vector2(0f, 0f), new Vector2(20f, 20f));
            bean    = new AnimatedObject(Content.Load <Texture2D>("bean"), new Vector2(0f, 0f), new Vector2(20f, 20f));
            bigBean = new AnimatedObject(Content.Load <Texture2D>("gros_bean"), new Vector2(0f, 0f), new Vector2(20f, 20f));

            //loading font
            _font = Content.Load <SpriteFont>("SpriteFont1");


            //loading sounds
            beanEaten1 = Content.Load <SoundEffect>("PelletEat1");
            beanEaten2 = Content.Load <SoundEffect>("PelletEat2");
            pacmanDead = Content.Load <SoundEffect>("PacmanEaten");
            ghostEaten = Content.Load <SoundEffect>("MonsterEaten");
            siren      = Content.Load <SoundEffect>("Siren").CreateInstance();
            invincible = Content.Load <SoundEffect>("Invincible").CreateInstance();


            //Loding animated characters
            animatedPacMan     = new AnimatedPacMan(Content.Load <Texture2D>("pacmanDroite0"), new Vector2(0f, 0f), new Vector2(20f, 20f), pacManCharacter);
            listAnimatedGhosts = new List <AnimatedGhost>();
            for (int i = 0; i < 4; i++)
            {
                listAnimatedGhosts.Add(new AnimatedGhost(Content.Load <Texture2D>("fantome" + i), new Vector2(0f, 0f), new Vector2(20f, 20f), listGhostCharacters.ElementAt(i)));
            }
        }