static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); PlayingField playingField = new PlayingField(new Size(10, 10), 27, 50, 5); FieldView fieldView = new FieldView(playingField, playingField.Size); PacmanController pacmanContorller = new PacmanController(playingField, fieldView); Application.Run(fieldView.Form); }
static void Main(string[] args) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); MainForm form; int width; int height; if (args.Length > 0) { width = int.Parse(args[0]); height = int.Parse(args[1]); } else { width = 800; height = 600; } if (args.Length > 2) { DynamicEntity.speed = int.Parse(args[2]); } form = new MainForm(new Size(width, height)); PacmanController pacmanController = new PacmanController(form); if (args.Length > 4) { pacmanController.SetCountObject(int.Parse(args[3]), int.Parse(args[4])); } form.SetController(pacmanController); if (args.Length > 5) { DynamicEntity.speed = int.Parse(args[5]); } pacmanController.NewGame(); Application.Run(form); }
private void btnNewGame_Click(object sender, EventArgs e) { ConfigForm config = new ConfigForm(); config.ShowDialog(); if (config.DialogResult == DialogResult.OK) { pacman = new PacmanController(config.ApplesCount, config.TanksCount); switch (config.Speed) { case 0: GameBeat.Interval = 70; break; case 1: GameBeat.Interval = 60; break; case 2: GameBeat.Interval = 50; break; default: break; } } else { return; } ShotBeat.Interval = GameBeat.Interval / 2; btnStats.Enabled = true; pacman.Start(this); GameBeat.Enabled = true; ShotBeat.Enabled = true; }