Esempio n. 1
0
        private void button1_Click(object sender, System.EventArgs e)
        {
            this.Hide();

            if (!DeveloperModeEnabled)
            {
                using (var game = new GalagaGame())
                {
                    ((System.Windows.Forms.Form)FromHandle(game.Window.Handle)).Icon =
                        new System.Drawing.Icon("Content\\Graphics\\PlayerShipIcon_002.ico");
                    game.Run();
                    newHighScoreMenu1.Show();
                    currHighScore = new HighScore("NA", game.playerScore, game.playerShip.PlayerLevel);
                }
            }
            else
            {
                using (var devGame = new GalagaGame(true))
                {
                    ((System.Windows.Forms.Form)FromHandle(devGame.Window.Handle)).Icon =
                        new System.Drawing.Icon("Content\\Graphics\\PlayerShipIcon_002.ico");
                    devGame.Run();
                }
            }


            this.Show();
        }
Esempio n. 2
0
        public override void Initialize(Texture2D texture, Vector2 position, GalagaGame game, GameTime gameTime = null)
        {
            Parent  = game;
            Texture = texture;

            MovingRight = (EnemyRand.Next(0, 2) == 0) ? true : false;   // 50/50 of starting moving right or left

            //MovingRight = true;
            MovingForward  = false;
            ForwardCounter = 0;
            // Set the starting position of the player around the middle of the screen and to the back

            Position = position;



            // Set the enemy to be active

            Active = true;


            // Speed in which the EnemyShip moves side to side

            StrafeSpeed = 3;


            // Speed in which EnemyShip moves up and down

            LateralSpeed = 4;

            // How often enemies can shoot

            ReloadSpeed = 50f;

            // How fast their bullets move forward

            BulletSpeed = 10;

            // Is the Enemy currently Reloading?

            Reloading = false;

            // The actual Timespan of how long it takes for the enemy to Reload

            ReloadTime = TimeSpan.FromSeconds(60f / ReloadSpeed * StartingEnemyLevel);

            try
            {
                LastFire = gameTime.TotalGameTime;  // Setting to the time of instance creation
            }
            catch (NullReferenceException ex)
            {
                Console.Error.WriteLine($"An instance of EnemyShip was not passed the gameTime: {ex}");
                LastFire = TimeSpan.Zero;
            }

            ChanceToFire = StartingEnemyLevel * 20; // Level 1 has 20 percent chance to shoot, level 5 always shoots
        }