I'm making the game four on a row (with oop)
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(...)
If the second player had to be a person the form calls the function --> MakeHumanPlayer
(Speler means Player)
And to play against a cpuPlayer i call this function
But i cant use the made player in the rest of the form ...
If anyone can help to solve this, i would be really glad.
i'm kind of new to the language .
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(...)
Code:
if (rdbSpeler.Checked == true) { SpelTegenSpeler(); rdbCpu.Visible = false;} else { SpelTegenSpeler(); rdbSpeler.Visible = false; }
Code:
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
Code:
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 .
Comment