コード例 #1
0
        private void btnContinue_Click(object sender, EventArgs e)
        {
            if (radTravel.Checked == true) // Opens the game
            {
                Game game = new Game();
                game.Show();

                Form introForm = new Introduction();
                introForm.Show();
            }
            else if (radLearn.Checked == true) // Opens the map
            {
                map map = new map();
                map.Show();
            }
            else if (radHunting.Checked == true) // Open hunting
            {
                Hunting hunting = new Hunting();
                hunting.Show();
            }
            else if (radExit.Checked == true) //Closes game
            {
                this.Close();
            }
        }
コード例 #2
0
        private void KeyisPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == (char)Keys.Escape) //opens option menu
            {
                gbEverything.Visible  = false;
                picCharacter.Visible  = false;
                lblEnter.Visible      = false;
                picbackground.Visible = false;
                gbOptions.Visible     = true;
                tmrRunGame.Stop();
                picCharacter.Image = OrganTrail.Properties.Resources.Sub2;
            }
            else if (gbOptions.Visible == true)
            {
                if (e.KeyChar == (char)Keys.D1) // Continues the game
                {
                    gbEverything.Visible  = true;
                    picCharacter.Visible  = true;
                    lblEnter.Visible      = true;
                    picbackground.Visible = true;
                    gbOptions.Visible     = false;
                    tmrRunGame.Start();
                    lblFacts.Text = " ";
                }
                else if (e.KeyChar == (char)Keys.D2) // Opens the map form
                {
                    Form mapForm = new map();
                    mapForm.Show();
                }

                else if (e.KeyChar == (char)Keys.D3) // Facts
                {
                    randomFact = randNumber.Next(1, 25);


                    if (randomFact == 1)
                    {
                        lblFacts.Text = "The only part of the body that has no blood supply is the cornea of the eye. It receives oxygen directly from the air.";
                    }
                    else if (randomFact == 2)
                    {
                        lblFacts.Text = "The human brain has a memory capacity which is the equivalent of more than four terabytes on a hard drive.";
                    }
                    else if (randomFact == 3)
                    {
                        lblFacts.Text = "A newborn child can breathe and swallow at the same time for up to seven months.";
                    }
                    else if (randomFact == 4)
                    {
                        lblFacts.Text = "Your skull is made up of 29 different bones.";
                    }
                    else if (randomFact == 5)
                    {
                        lblFacts.Text = "Nerve impulses sent from the brain move at a speed of 274 km/h.";
                    }
                    else if (randomFact == 6)
                    {
                        lblFacts.Text = "A single human brain generates more electrical impulses in a day than all the telephones of the world combined.";
                    }
                    else if (randomFact == 7)
                    {
                        lblFacts.Text = "The average human body contains enough sulphur to kill all the fleas on the average dog, enough carbon to make 900 pencils, enough potassium to fire a toy cannon, enough fat to make seven bars of soap and enough water to fill a 50-litre barrel.";
                    }
                    else if (randomFact == 8)
                    {
                        lblFacts.Text = "The human heart pumps 182 million litres of blood during the average lifetime.";
                    }
                    else if (randomFact == 9)
                    {
                        lblFacts.Text = "50,000 cells in your body died and were replaced by new ones while you were reading this sentence.";
                    }
                    else if (randomFact == 10)
                    {
                        lblFacts.Text = "The human embryo acquires fingerprints within three months of conception.";
                    }
                    else if (randomFact == 11)
                    {
                        lblFacts.Text = "Women’s hearts beat faster than men’s.";
                    }
                    else if (randomFact == 12)
                    {
                        lblFacts.Text = "A man named Charles Osborne hiccupped for a total of 68 years.";
                    }
                    else if (randomFact == 13)
                    {
                        lblFacts.Text = "Right-handed people live, on average, nine years longer than left-handed people.";
                    }
                    else if (randomFact == 14)
                    {
                        lblFacts.Text = "About two thirds of people tilt their head to the right when kissing.";
                    }
                    else if (randomFact == 15)
                    {
                        lblFacts.Text = "The average person forgets 90% of their dreams.";
                    }
                    else if (randomFact == 16)
                    {
                        lblFacts.Text = "The total length of all the blood vessels in the human body is about 100,000 km.";
                    }
                    else if (randomFact == 17)
                    {
                        lblFacts.Text = "On average, a person’s respiration rate is one third higher in spring than in autumn.";
                    }
                    else if (randomFact == 18)
                    {
                        lblFacts.Text = "By the end of a person’s life, they can recall, on average, around 150 trillion pieces of information.";
                    }
                    else if (randomFact == 19)
                    {
                        lblFacts.Text = "We lose 80% of our body heat from the head.";
                    }
                    else if (randomFact == 20)
                    {
                        lblFacts.Text = "When you blush, your stomach also turns red.";
                    }
                    else if (randomFact == 21)
                    {
                        lblFacts.Text = "A feeling of thirst occurs when water loss is equal to 1% of your body weight. The loss of more than 5% can cause fainting, and more than 10% causes death from dehydration.";
                    }
                    else if (randomFact == 22)
                    {
                        lblFacts.Text = "At least 700 enzymes are active in the human body.";
                    }
                    else if (randomFact == 23)
                    {
                        lblFacts.Text = "Human beings are the only living things which sleep on their backs.";
                    }
                    else if (randomFact == 24)
                    {
                        lblFacts.Text = "The average four-year-old child asks 450 questions a day.";
                    }
                    else if (randomFact == 25)
                    {
                        lblFacts.Text = "Not only human beings, but also koalas have unique finger prints.";
                    }
                }
                else if (e.KeyChar == (char)Keys.D4) // Introduction
                {
                    Form introForm = new Introduction();
                    introForm.Show();
                }
            }
            if (lblEvents.Visible == true)
            {
                if (e.KeyChar == (char)Keys.Back) // Continues the game after events
                {
                    lblEvents.Visible = false;
                    tmrRunGame.Start();
                    lblSpace.Visible = false;
                    picFood.Visible  = false;
                }
            }
            if (lblEnd.Visible == true)
            {
                if (e.KeyChar == (char)Keys.Escape) // closes the game after you lose or win
                {
                    this.Close();
                }
            }
        }
コード例 #3
0
        private void KeyisPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == (char)Keys.Escape) //opens option menu
            {
                gbEverything.Visible = false;
                picCharacter.Visible = false;
                lblEnter.Visible     = false;
                gbOptions.Visible    = true;
                tmrRunGame.Stop();
                picCharacter.Image = OrganTrail.Properties.Resources.Sub2;
            }
            else if (gbOptions.Visible == true)
            {
                if (e.KeyChar == (char)Keys.D1) // Continues the game
                {
                    gbEverything.Visible = true;
                    picCharacter.Visible = true;
                    lblEnter.Visible     = true;
                    gbOptions.Visible    = false;
                    tmrRunGame.Start();
                    lblFacts.Text = " ";
                }
                else if (e.KeyChar == (char)Keys.D2) // Opens the map form
                {
                    Form mapForm = new map();
                    mapForm.Show();
                }

                else if (e.KeyChar == (char)Keys.D3) // Facts
                {
                    randomFact = randNumber.Next(1, 10);


                    if (randomFact == 1)
                    {
                        lblFacts.Text = "The only part of the body that has no blood supply is the cornea of the eye. It receives oxygen directly from the air.";
                    }
                    else if (randomFact == 2)
                    {
                        lblFacts.Text = "The human brain has a memory capacity which is the equivalent of more than four terabytes on a hard drive.";
                    }
                    else if (randomFact == 3)
                    {
                        lblFacts.Text = "A newborn child can breathe and swallow at the same time for up to seven months.";
                    }
                    else if (randomFact == 4)
                    {
                        lblFacts.Text = "Your skull is made up of 29 different bones.";
                    }
                    else if (randomFact == 5)
                    {
                        lblFacts.Text = "Nerve impulses sent from the brain move at a speed of 274 km/h.";
                    }
                    else if (randomFact == 6)
                    {
                        lblFacts.Text = "A single human brain generates more electrical impulses in a day than all the telephones of the world combined.";
                    }
                    else if (randomFact == 7)
                    {
                        lblFacts.Text = "The average human body contains enough sulphur to kill all the fleas on the average dog, enough carbon to make 900 pencils, enough potassium to fire a toy cannon, enough fat to make seven bars of soap and enough water to fill a 50-litre barrel.";
                    }
                    else if (randomFact == 8)
                    {
                        lblFacts.Text = "The human heart pumps 182 million litres of blood during the average lifetime.";
                    }
                    else if (randomFact == 9)
                    {
                        lblFacts.Text = "50,000 cells in your body died and were replaced by new ones while you were reading this sentence.";
                    }
                    else if (randomFact == 10)
                    {
                        lblFacts.Text = "The human embryo acquires fingerprints within three months of conception.";
                    }
                }
                else if (e.KeyChar == (char)Keys.D4) // Introduction
                {
                    Form introForm = new Introduction();
                    introForm.Show();
                }
            }
            if (lblEvents.Visible == true)
            {
                if (e.KeyChar == (char)Keys.Back) // Continues the game after events
                {
                    lblEvents.Visible = false;
                    tmrRunGame.Start();
                    lblSpace.Visible = false;
                    picFood.Visible  = false;
                }
            }
            if (lblEnd.Visible == true)
            {
                if (e.KeyChar == (char)Keys.Escape) // closes the game after you lose or win
                {
                    this.Close();
                }
            }
        }