public static int InitialJumps(Ghosts ghost, bool newLevel) { if (newLevel) { switch (ghost) { case Ghosts.Inky: return((int)MathHelper.Clamp((20 - Level) / 2, 0, 10)); case Ghosts.Clyde: return(InitialJumps(Ghosts.Inky, true) + 2); default: return(0); } } switch (ghost) { case Ghosts.Inky: return(1); case Ghosts.Clyde: return(2); default: return(0); } }
public GameForm() { ghosts = new Ghosts(this); ghosts.Load(); player = new PacMan(this); player.Load(); InitializeComponent(); }
/// <summary> /// Instantiates a ghost. /// </summary> /// <param name="game">A reference to the Game object, needed for access to services.</param> /// <param name="player">A reference to the Pac Man, needed for AI.</param> /// <param name="identity">Which ghost, needed for appearance and behavior.</param> public Ghost(Game game, Player player, Ghosts identity) { spriteBatch_ = (SpriteBatch)game.Services.GetService(typeof(SpriteBatch)); ghostBase1_ = game.Content.Load <Texture2D>("sprites/GhostBase"); ghostBase2_ = game.Content.Load <Texture2D>("sprites/GhostBase2"); ghostChased_ = game.Content.Load <Texture2D>("sprites/GhostChased"); eyesBase_ = game.Content.Load <Texture2D>("sprites/GhostEyes"); eyesCenter_ = game.Content.Load <Texture2D>("sprites/GhostEyesCenter"); colorBase_ = Constants.Colors(identity); identity_ = identity; previousNumCrumps_ = 0; Reset(true, player); wiggle_ = true; direction_ = new Direction(); lastJunction_ = new Point(); scatterTiles_ = Constants.ScatterTiles(identity); }
//Check If Game is over public bool IsGameOver(Ghosts ghosts, PacMan player) { bool isGameOver = false; if (ghosts.GetBounds("blinky").IntersectsWith(player.GetBounds())) { isGameOver = true; ghostName = "Blinky"; score = takenCoinCount; } if (ghosts.GetBounds("inky").IntersectsWith(player.GetBounds())) { isGameOver = true; ghostName = "Pinky"; score = takenCoinCount; } return(isGameOver); }
public static Position StartPosition(Ghosts identity) { switch (identity) { case Ghosts.Blinky: return(StartPositionBlinky); case Ghosts.Pinky: return(StartPositionPinky); case Ghosts.Clyde: return(StartPositionClyde); case Ghosts.Inky: return(StartPositionInky); default: throw new ArgumentException(); } }
public static List <Point> ScatterTiles(Ghosts identity) { switch (identity) { case Ghosts.Blinky: return(ScatterTilesBlinky); case Ghosts.Clyde: return(ScatterTilesClyde); case Ghosts.Inky: return(ScatterTilesInky); case Ghosts.Pinky: return(ScatterTilesPinky); default: throw new ArgumentException(); } }
public static Color Colors(Ghosts identity) { switch (identity) { case Ghosts.Blinky: return(Color.Red); case Ghosts.Clyde: return(Color.Orange); case Ghosts.Inky: return(Color.LightSkyBlue); case Ghosts.Pinky: return(Color.LightPink); default: throw new ArgumentException(); } }