Пример #1
0
        /*
         *
         * Initializes all the timers to start the game,
         * and initializes the earth.
         *
         */

        private void StartGame()
        {
            earth = new Earth(200, 400, 2, 3, InitEarthPic());

            shipPool.Add(earth);

            Space.Children.Add(earth.Rect);

            spawnTimer = 1500;

            timetoMove          = new Timer(5);
            timetoMove.Elapsed += MoveEnemyShip;

            timetoMove.AutoReset = true;
            timetoMove.Enabled   = true;

            laserTimer          = new Timer(500);
            laserTimer.Elapsed += CoolLasersDown;

            laserTimer.AutoReset = true;
            laserTimer.Enabled   = true;

            enemyFire          = new Timer(2000);
            enemyFire.Elapsed += EnemiesFire;

            enemyFire.AutoReset = true;
            enemyFire.Enabled   = true;

            spawnEnemy          = new Timer(spawnTimer);
            spawnEnemy.Elapsed += SpawnEnemies;

            spawnEnemy.AutoReset = true;
            spawnEnemy.Enabled   = true;
        }
Пример #2
0
        public MainWindow()
        {
            InitializeComponent();

            Panel1.Width  = screenWidth / 3;
            Panel1.Height = screenHeight;
            Panel2.Width  = screenWidth / 3;
            Panel2.Height = screenHeight;
            Space.Width   = screenWidth / 3;
            Space.Height  = screenHeight;

            TopWindow.MinHeight = screenHeight;
            TopWindow.MinWidth  = screenWidth;
            TopWindow.Height    = screenHeight;
            TopWindow.Width     = screenWidth;

            Hide();

            Splash splash = new Splash();

            splash.Show();
            System.Threading.Thread.Sleep(5000);
            splash.Close();

            StartMusic();

            Show();

            earth = new Earth(200, 400, 2, 3, InitEarthPic());

            ShowStartScreen();

            //StartGame();
        }