//------------------------------- public void restartStats() { LeftLeg = null; RightLeg = null; LeftHand = null; Head = null; RightHand = null; int index = rand.Next(0, words.Length - 1); word = words[index]; plusPoints = 0; negPoints = 0; MaxPoints = word.Length; //Record = 0; time = 60; }
//-----// //Graphics// private void Hangman_Paint(object sender, PaintEventArgs e) { Graphics g = e.Graphics; if (FIRST_LEVEL) { WordBox.Visible = false; foreGround.DrawImage(g); } if (SECOND_LEVEL) { if (resetPicture) { restartStats(); } WordBox.Visible = true; scoreFrame.DrawImage(g); stand.DrawImage(g); menu.DrawImage(g); #if MyDebug g.DrawString($"X: {cursX}, Y: {cursY}", f, Brushes.Black, 0, 0); #endif if (winEnable) { g.DrawString($"You win !\nTime: {time} Record: {Record}\nThe word was: {lastword}", f, Brushes.Green, 500, 20); } else if (loseEnable) { g.DrawString($"You lose !\nTime: {time} Record: {Record}\nThe word was: {lastword}", f, Brushes.Red, 500, 20); } else { g.DrawString($"Time: {time}\n\nRecord: {Record}", f, Brushes.Black, 500, 20); } if (negPoints >= 1) { if (negPoints >= 1) { Head = new CImageVersionOut(Resources.Head) { Left = 260, Top = 15 }; Head.DrawImage(g); //First picture if (MaxPoints == 1) { LeftLeg = new CImageVersionOut(Resources.Left_Leg_and_Torso) { Left = 210, Top = 185 }; LeftLeg.DrawImage(g); LeftHand = new CImageVersionOut(Resources.Left_Hand) { Left = 185, Top = 228 }; LeftHand.DrawImage(g); RightHand = new CImageVersionOut(Resources.Right_Hand) { Left = 315, Top = 228 }; RightHand.DrawImage(g); RightLeg = new CImageVersionOut(Resources.Right_Leg) { Left = 320, Top = 305 }; RightLeg.DrawImage(g); } } if (negPoints >= 2) { LeftLeg = new CImageVersionOut(Resources.Left_Leg_and_Torso) { Left = 210, Top = 185 }; LeftLeg.DrawImage(g); //Second picture if (MaxPoints == 2) { LeftHand = new CImageVersionOut(Resources.Left_Hand) { Left = 185, Top = 228 }; LeftHand.DrawImage(g); RightHand = new CImageVersionOut(Resources.Right_Hand) { Left = 315, Top = 228 }; RightHand.DrawImage(g); } } if (negPoints >= 3) { LeftHand = new CImageVersionOut(Resources.Left_Hand) { Left = 185, Top = 228 }; LeftHand.DrawImage(g); //third picture if (MaxPoints == 3) { RightHand = new CImageVersionOut(Resources.Right_Hand) { Left = 315, Top = 228 }; RightHand.DrawImage(g); RightLeg = new CImageVersionOut(Resources.Right_Leg) { Left = 320, Top = 305 }; RightLeg.DrawImage(g); } } if (negPoints >= 4) { RightHand = new CImageVersionOut(Resources.Right_Hand) { Left = 315, Top = 228 }; RightHand.DrawImage(g); //fourth picture if (MaxPoints == 4) { RightLeg = new CImageVersionOut(Resources.Right_Leg) { Left = 320, Top = 305 }; RightLeg.DrawImage(g); } } if (negPoints >= 5) { RightLeg = new CImageVersionOut(Resources.Right_Leg) { Left = 320, Top = 305 }; RightLeg.DrawImage(g); //third picture if (MaxPoints == 5) { //others } } if (negPoints >= 6) { //fourth picture if (MaxPoints == 6) { //others } } } } }