private void button3_Click(object sender, EventArgs e) { char colonne = tb_bomb.Text[0]; int ligne = Convert.ToInt16(tb_bomb.Text[1] + ""); if (Fonctions.tirer(joueurCourant, colonne, ligne)) { MessageBox.Show("Touché ! Bravo !"); if (Fonctions.testerVictoire(joueurCourant)) { MessageBox.Show("bravo, vous avez gagné la partie !"); p_zoneJeu.Visible = false; panel1.Visible = false; } } else { MessageBox.Show("Raté ! Essayez encore !"); } if (joueurCourant == 1) { joueurCourant = 2; } else { joueurCourant = 1; } afficherMasque(joueurCourant); l_qui.Text = "" + joueurCourant; }
public Form1() { InitializeComponent(); Fonctions.initialiser(); zoneAffichage = new PictureBox[3, 3]; zoneAffichage[0, 0] = pictureBox1; zoneAffichage[1, 0] = pictureBox2; zoneAffichage[2, 0] = pictureBox3; zoneAffichage[0, 1] = pictureBox4; zoneAffichage[1, 1] = pictureBox5; zoneAffichage[2, 1] = pictureBox6; zoneAffichage[0, 2] = pictureBox7; zoneAffichage[1, 2] = pictureBox8; zoneAffichage[2, 2] = pictureBox9; }
public void placerPedalo() { char colonne = tb_case1.Text[0]; int ligne = Convert.ToInt16(tb_case1.Text[1] + "") - 1; int colonneReelle = Fonctions.positionColonne(colonne); if (joueurCourant == 1) { Fonctions.tj1[colonneReelle, ligne] = 'P'; } else { Fonctions.tj2[colonneReelle, ligne] = 'P'; } char colonne2 = tb_case2.Text[0]; int ligne2 = Convert.ToInt16(tb_case2.Text[1] + "") - 1; int colonneReelle2 = Fonctions.positionColonne(colonne2); char[,] tabDuJoueurCourant; if (joueurCourant == 1) { tabDuJoueurCourant = Fonctions.tj1; } else { tabDuJoueurCourant = Fonctions.tj2; } if (Fonctions.placementPossible(colonneReelle, ligne, colonneReelle2, ligne2, tabDuJoueurCourant)) { if (joueurCourant == 1) { Fonctions.tj1[colonneReelle2, ligne2] = 'P'; } else { Fonctions.tj2[colonneReelle2, ligne2] = 'P'; } afficherDemasque(joueurCourant); if (joueurCourant == 1) { MessageBox.Show("Pédalo bien placé. Au joueur 2 de placer son pédalo."); afficherDemasque(joueurCourant); joueurCourant = 2; } else { MessageBox.Show("Pédalo bien placé. La partie peut commencer ! Bonne chance !"); p_placement.Visible = false; panel1.Visible = true; l_qui.Text = "1"; afficherMasque(joueurCourant); joueurCourant = 1; } } else { MessageBox.Show("Vous ne pouvez pas mettre le pédalo sur cet endroit"); } }