- Home /
triplex 2d unity game
Im a beginner and im making a triplex game which you are asked to put 3 numbers that fits the sum and product given to you , and i want to increase difficulty with every correct answer by clicking on checkanswer button , im stuck on that and i started coding many things and here is my code lastly .... pls help guys,Im making a triplex game where you are asked to put 3 numbers which fits the product and sum given to you , and i want to make the difficulty increases with every correct answer by clicking on checkanswer button but im stuck pls guys any help im a beginnner .. here is the code:::
using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.SceneManagement; using UnityEngine.UI;
public class TRPLX : MonoBehaviour { public int no1; public int no2; public int no3; public Text Sum; public Text product; public InputField number1; public InputField number2; public InputField number3; public int sumvalue; public int productvalue; public int no1guess; public int no2guess; public int no3guess;
 public int guesssum;
 public int guessproduct;
 public Text score;
 public int score_int = 1;
 public bool Playgame(int leveldifficulty = 1)
 {
    
     no1 = UnityEngine.Random.Range(leveldifficulty, leveldifficulty);
     no2 = UnityEngine.Random.Range(leveldifficulty, leveldifficulty);
     no3 = UnityEngine.Random.Range(leveldifficulty, leveldifficulty);
     sumvalue = no1 + no2 + no3;
     productvalue = no1 * no2 * no3;
     print(no1);
     print(no2);
     print(no3);
     print(Sum.text);
     print(product.text);
     number1.text = no1guess.ToString();
     number2.text = no2guess.ToString();
     number3.text = no3guess.ToString();
     Sum.text = sumvalue.ToString();
     product.text = productvalue.ToString();
     guesssum = no1guess + no2guess + no3guess;
     guessproduct = no1guess * no2guess * no3guess;
     return false;
 }
 public void mybutton()
 { 
 if (guesssum == sumvalue & guessproduct == productvalue)
     {
         print("correct");
         
     }
     else
     {
         print("failed");
      
       
     }
   
    
 }
    
 public void Start()
 {
     print("hello");
     int level = 1;
     while (true)
     {
         bool levelcomplete = Playgame(level);
         if (levelcomplete)
         {
             level++;
         
         }
       
     }
 }
   
}
Your answer
 
 
             Follow this Question
Related Questions
How do I get the square root of a double number value? 2 Answers
How to activate gameObjects based on a boolean from another scene? 1 Answer
How to get step sound using axis.x movement 2 Answers
How to stop the carried object from moving way when parented to the player camera? 2 Answers
Side scroller spawns at different Y 1 Answer
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                