On the form the player has to indicate if he is playing against a Person or to the computer.
(this is done bij indicating the right radiobutton)
Then in the code it will controle this with an if(...)
Expand|Select|Wrap|Line Numbers
- if (rdbSpeler.Checked == true)
- { SpelTegenSpeler();
- rdbCpu.Visible = false;}
- else
- { SpelTegenSpeler(); rdbSpeler.Visible = false; }
Expand|Select|Wrap|Line Numbers
- public void SpelTegenSpeler()
- {
- Speler Speler2 = new Speler(2, Color.Yellow, false);
- //Naam laten invoeren van de speler
- frmInputbox InputboxNaam2 = new frmInputbox();
- InputboxNaam2.ShowDialog();
- //Naam gelijk stellen aan het ingestelde
- Speler2.Naam = InputboxNaam2.naam;
- InputboxNaam2.Dispose();
- }
And to play against a cpuPlayer i call this function
Expand|Select|Wrap|Line Numbers
- public void SpelTegenComputer()
- { ComputerSpeler Speler2 = new ComputerSpeler(2,Color.Yellow,false);
- //Naam toewijzen
- Speler2.Naam = "[BOT]Speler2";}
If anyone can help to solve this, i would be really glad.
i'm kind of new to the language .