Click here to Skip to main content
15,897,273 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I would like to change the game i have (a simon says game in C#) to react to a bluetooth signal from a NXT bot

This is the code i used for the butten click

C#
private void simonButton_Click(object sender, EventArgs e)
    {
      if (m_game.Play == true)
      {
        Button btn = (Button)sender;
        int val = 4;

        switch (btn.Text)
        {
          case "simonButton1":
            val = 0;
          break;

          case "simonButton2":
            val = 1;
          break;

          case "simonButton3":
            val = 2;
          break;

          case "simonButton4":
            val = 3;
          break;
        }

        if (val == m_game.TheArray[m_game.Count])
        {
          if (m_game.Count < m_game.Turn)
          {
            m_game.Count++;
          }
          else
          {
            m_game.Play = false;
            m_game.Turn++;
            simonButton1.Enabled = false;
            simonButton2.Enabled = false;
            simonButton3.Enabled = false;
            simonButton4.Enabled = false;
            m_game.Restart();
          }
        }
        else
        {
          m_game.GameOver();
          simonButton1.Enabled = false;
          simonButton2.Enabled = false;
          simonButton3.Enabled = false;
          simonButton4.Enabled = false;
          this.button1.Enabled = true;
Posted
Comments
[no name] 5-Oct-12 6:48am    
And?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900