Click here to Skip to main content
12,625,402 members (35,249 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C# NXT
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

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 5-Oct-12 1:00am
Comments
Wes Aday 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)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.161128.1 | Last Updated 5 Oct 2012
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100