コード例 #1
0
        private void TmrDeath_Tick(object sender, EventArgs e)
        {
            if (Enemey.Health == 0)
            {
                //Stop Timer
                TmrDeath.Stop();

                //Tell how have been killed
                StartMeny.DUN.Play();
                MessageBox.Show(Enemey.Name + " has been killed", "Robomoon", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);

                //Our Characters has already been created
                Characters.CreatorNotRun = false;
                RobomoonChoose choose = new RobomoonChoose();
                choose.Show();
                this.Hide();
            }
            else if (Player.Health == 0)
            {
                //Stop Timer
                TmrDeath.Stop();

                //Tell how have been killed
                StartMeny.dun.Play();
                MessageBox.Show(Player.Name + " has been killed", "Plyer Killed", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);

                //Our Characters has already been created
                Characters.CreatorNotRun = false;
                RobomoonChoose choose = new RobomoonChoose();
                choose.Show();
                this.Hide();
            }
        }
コード例 #2
0
        //
        // Healthbar do all health check/update and so on
        //
        void HealthCheck(Characters characters)
        {
            //
            // Robomoon Health Update
            //
            if (characters == Enemey)
            {
                //If health is or under 0 the game is over.
                if (Enemey.Health <= 0)
                {
                    Enemey.Health       = 0;
                    PbrRobomoonHP.Value = 0;
                    Enemey.Apearence    = Enemey.DeathApearence;
                    PbxRobomoon.Image   = Enemey.Apearence;

                    GbxActions.Enabled = false;
                    TmrDeath.Start();
                }
                //if the Robomoon is not dead a update of the healthbar will run.
                PbrRobomoonHP.Value = Healthbar(Enemey);
            }

            //If health is or under 0 the game is over.
            else if (characters == Player)
            {
                if (Player.Health <= 0)
                {
                    Player.Health        = 0;
                    PbrCharacterHP.Value = 0;
                    Player.Apearence     = Player.DeathApearence;
                    PbxCharacter.Image   = Player.Apearence;

                    GbxActions.Enabled = false;
                    TmrDeath.Start();
                }
                //if the Character is not dead a update of the healthbar will run.
                PbrCharacterHP.Value = Healthbar(Player);
            }
        }