// --- methods --- // /// <summary> /// Constructor of Inky. /// </summary> /// <param name="map">The map where Inky evolve.</param> /// <param name="pacman">The pacman to chase.</param> public Inky(Map map, Pacman pacman, Blinky blinky) : base(map, pacman) { _blinky = blinky; }
/// <summary> /// Constructor of Blinky. /// </summary> /// <param name="map">The map where Blinky evolve.</param> /// <param name="pacman">The pacman to chase.</param> public Blinky(Map map, Pacman pacman) : base(map, pacman) { _elroySpeed = 0; }
private void PrepareGame(int levelIN, int scoreIN, int livesIN) { if( this.newMap != null ) { this.mapa = this.newMap; } else { this.mapa = new Map ( 0 ); } if(this.pac == null ) this.pac = new Pacman (this.mapa , 1, 3, 0); else { this.pac.mapa = this.mapa; this.pac.position = this.mapa.GetStartPosition(); } if(SB != null) SB.Dispose(); #if DEBUG Console.WriteLine("[OK] Map and Pacman create."); #endif #region /* rozmery */ this.PlaygroundWidth = this.mapa.map.GetLength(0) * this.sizeField + 30; this.PlaygroundHeight = this.mapa.map.GetLength(1) * this.sizeField + 60; #endregion #region /* status bar */ SB = new StatusBar(); SB.Parent = this; SB.Text = "SPEED: " + this.actualSpeed.ToString() + "; LIVES: 3; SCORE: 0"; SB.Anchor = AnchorStyles.Bottom; SB.Dock = DockStyle.Bottom; SB.Font = new Font("serif", 13); SB.Height = 25; SB.Width = this.PlaygroundWidth - 5; SB.ForeColor = Color.AliceBlue; #endregion this.bonusIs = true; this.BackColor = Color.Black; this.Select(); // ziskani zamereni ClientSize = new Size( this.PlaygroundWidth, this.PlaygroundHeight ); Paint -= new PaintEventHandler( this.OnStart ); Paint += new PaintEventHandler( this.OnPaint ); }
// -- attributes --- // // --- methods --- // /// <summary> /// Constructor of Clyde. /// </summary> /// <param name="map">The map where Clyde evolve.</param> /// <param name="pacman">The pacman to chase.</param> public Clyde(Map map, Pacman pacman) : base(map, pacman) { }
// -- attributes --- // // --- methods --- // /// <summary> /// Constructor of Pinky. /// </summary> /// <param name="map">The map where Pinky evolve.</param> /// <param name="pacman">The pacman to chase.</param> public Pinky(Map map, Pacman pacman) : base(map, pacman) { }
// --- methods --- // /// <summary> /// Constructor of Ghost class. /// </summary> /// <param name="map">Map of the pacman game.</param> /// <param name="pacman">The pacman evolving in the map.</param> public Ghost(Map map, Pacman pacman) : base(map) { _pacman = pacman; }
/// <summary> /// Constructor of the game main loop. /// </summary> public GameLoop() { Content.RootDirectory = "Content"; _graphics = new GraphicsDeviceManager(this); _graphics.PreferredBackBufferWidth = 448; _graphics.PreferredBackBufferHeight = 576; _graphics.ApplyChanges(); _ghosts = new Ghost[4]; _map = new Map(_ghosts); _pacman = new Pacman(_map); Blinky blinky = new Blinky(_map, _pacman); Pinky pinky = new Pinky(_map, _pacman); Inky inky = new Inky(_map, _pacman, blinky); Clyde clyde = new Clyde(_map, _pacman); _ghosts[0] = blinky; _ghosts[1] = pinky; _ghosts[2] = inky; _ghosts[3] = clyde; _score = 0; _eatingScore = 0; _life = 3; _level = 1; _ready = 60 * 4; this.IsMouseVisible = true; _isOnHomeScreen = true; _homeScreen = new HomeScreen(_score, _highScore); }