Пример #1
0
        public Form1()
        {
            InitializeComponent();
            StartWindow();
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
            this.DoubleBuffered = true;
            this.gameStarted = false;

            Bullets = new BulletsDoc();
            Houses = new HousesDoc(this.Width);
            Kids = new KidsDoc();
            Clouds = new CloudsDoc(this.Width, this.Height);
            Music = new Sounds();
            Levels = new LevelsDoc();
            CurrentLevel = new List<Kid>();
            CarItems = new CarDoc();
            Players = new PlayersDoc();
            KidsKilled = 0;
        }
Пример #2
0
 private void levelFinished()
 {
     if (Kids.Kids.Count == 0 && CurrentLevel.Count == 0)
     {
         //nextlevel
         timerNewHouse.Stop();
         timerNewCloud.Stop();
         timerDrawing.Stop();
         NextLevelWindow nextLevel = new NextLevelWindow();
         if (nextLevel.ShowDialog() == DialogResult.OK)
         {
             Kids = new KidsDoc();
             Bullets = new BulletsDoc();
             Houses = new HousesDoc(this.Width);
             CurrentLevel = Levels.getNextLevel();
             gameStarted = true;
             Houses.startMoving();
             StartWindow();
         }
         else
         {
             nextLevel = null;
             gameOver();
         }
     }
 }
Пример #3
0
 private void showMainMenu()
 {
     timerNewHouse.Stop();
     Kids = new KidsDoc();
     Houses = new HousesDoc(this.Width);
     Levels = new LevelsDoc();
     Clouds = new CloudsDoc(this.Width, this.Height);
     Bullets = new BulletsDoc();
     showButtons();
     CarItems.MoveToStart();
     gameStarted = false;
     StartWindow();
 }
Пример #4
0
 private void gameOver()
 {
     timerNewHouse.Stop();
     timerDrawing.Stop();
     GameOverWindow gameOver = new GameOverWindow();
     writeToFile(gameOver.PlayerName, this.KidsKilled);
     this.KidsKilled = 0;
     DialogResult res=gameOver.ShowDialog();
     if ( res== DialogResult.OK)
     {
         Kids = new KidsDoc();
         Bullets = new BulletsDoc();
         Levels = new LevelsDoc();
         Houses = new HousesDoc(this.Width);
         CurrentLevel = Levels.getNextLevel();
         gameStarted = true;
         Houses.startMoving();
         StartWindow();
     }
     else if(res == DialogResult.No)
     {
         Application.Exit();
     }
     else
     {
         gameOver = null;
         showMainMenu();
     }
 }