/// <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(); }
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(); }
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(); }
/// <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"); }
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); }