Ejemplo n.º 1
0
        /// <summary>
        /// Creates a new pellet object;
        /// </summary>
        /// <param name="level"></param>
        /// <param name="position">
        /// Represents the center of the tile which containts the pellet
        /// </param>
        public Pellet(Level level, Vector2 position)
        {
            this.position = position;
            this.level = level;
            this.color = Color.Teal;

            LoadContent();
        }
Ejemplo n.º 2
0
        public Player(Level level, Vector2 position)
        {
            this.level = level;
            this.position = position;
            this.speed = 2;
            this.direction = Direction.Right;
            this.nextDirection = Direction.Right;
            this.IsAlive = true;

            LoadContent();
        }
Ejemplo n.º 3
0
        public Ghost(Level level, Vector2 position, Color colour, AI aiType)
        {
            this.level = level;
            this.position = position;
            this.speed = 2;
            this.direction = Direction.Right;
            this.colour = colour;
            this.aiType = aiType;

            LoadContent();
        }
Ejemplo n.º 4
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);

            pacmanSprite = PacmanSprite.create(this, graphics);
            ghostSprites = new GhostSprite[] {
                GhostSprite.create(this, graphics, Color.Thistle),
                GhostSprite.create(this, graphics, Color.SteelBlue),
                GhostSprite.create(this, graphics, Color.Blue),
                GhostSprite.create(this, graphics, Color.Violet),
                GhostSprite.create(this, graphics, Color.Turquoise)
            };
            level = Level.create(this, graphics);

            scoreFont = Content.Load<SpriteFont>("Fonts/Score");
            gameOverFont = Content.Load<SpriteFont>("Fonts/GameOver");
            am = Content.Load<SoundEffect>("Audio/am");
            bum = Content.Load<SoundEffect>("Audio/bum");
        }
Ejemplo n.º 5
0
 private void LoadNextLevel()
 {
     levelIndex = (levelIndex + 1) % numberOfLevels;
     string levelPath = string.Format("Content/Levels/{0}.txt", levelIndex);
     using (Stream fileStream = TitleContainer.OpenStream(levelPath))
         level = new Level(Services, fileStream);
 }