Hello there !
I'm writing four in a row in csharp.
It's almost done, the only problem is the control for when there actually is four in a row.
I have vertical and horizontal working perfectly fine, diagonal from down-left to right up should work to.
Only if i put in the code i found for left-up to downright, sometimes i get a random message that a player won.
Does anyone see the mistake ?
...
User Profile
Collapse
-
Does anyone see the mistake in this code ?
-
Thank you for your respond !
I found the answer.
I had to declare the 2 players at the top like this
Code:public partial class frmVieropeenrij : Form { byte NieuwSpel; Spel GestartSpel = new Spel(); Graphics spelbord; private Speler Speler1; private Speler Speler2; // rest of code
-
Is there a way to use a variable from a function in the whole form ?
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(...)
Code:if (rdbSpeler.Checked == true) { SpelTegenSpeler(); rdbCpu.Visible = false;} else { SpelTegenSpeler(); rdbSpeler.Visible = false; }
-
Using MouseEnter on picturebox
Im quite new at csharp and im trying to use the onmouseenter event but i can't get it to work.
i used;
Code:private void picDraw_MouseEnter(object sender, EventArgs e) { the action } private void picDraw_OnMouseEnter(object sender, EventArgs e) { the action }
No activity results to display
Show More
Leave a comment: