Skip to main content

On Sale: GamesAssetsToolsTabletopComics
Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
(+1)

I think I now have to write 100 times "I won't punch the teacher again" for tomorrow... Great idea et congrats on doing this in less than 3 hours!

Thanks for playing and thanks for the feedback!

If I had a nickel for every person saying they tried to punch the teacher I'd have two nickels, which isn't a lot but it's weird that it happened twice.

btw it's easier to make the game quicker when you fully embrace the spaghetti code.

This is most of the game code lmao

void Start()
{
    int r = Random.Range(1, 10);
    if (r > 5)
        IsTarget = false; //randomly makes the character a non nerd or a nerd
    else
        MyScore.CurrentNerds += 1; //if the character is a nerd, count them in the score script, in order to reset the room once there are no nerds
    n1 = Random.Range(1, 9);
    n2 = n2b = Random.Range(1, 9); //generate 2 numbers from 1 to 8, n2b is the wrong number for when it's not a nerd
    GenerateN2(); //generates a n2b value for the non nerds to use
    ran = Random.Range(0, 2); //randomly calls which type of operation we're using
    if (ran == 0) result = IsTarget ? n1 + n2 : n1 + n2b; //if it's a sum, we get n1+n2 if it's a nerd or n1+n2b if it's not a nerd
    else if(ran == 1) result = IsTarget ? n1 - n2 : n1 - n2b;//if it's a subtraction, we get n1-n2 if it's a nerd or n1-n2b if it's not a nerd
    else if(ran == 2) result = IsTarget ? n1 / n2 : n1 / n2b;//not used, for division
    else if(ran == 3) result = IsTarget ? n1 * n2 : n1 * n2b; //not used, for multiplication
    AnswerDisplay.text = n1.ToString() + GenerateOperator() + n2.ToString() + " = " + result.ToString(); //shows in the text bubble the kid's answer
}
public string GenerateOperator()
{
    if (ran == 0) return " + "; else if (ran == 1) return " - "; else if (ran == 2) return " * "; else if (ran == 3) return " / "; else return " Operator Error ";
}
public void GenerateN2()
{
    var i = Random.Range(1, 3);
    if (i == 1) n2b -= Random.Range(1, 9);
    else if (i >= 2) n2b += Random.Range(1, 9); //changes the value of n2b to be different from that of n2, so it's always from 1 to 9 up or down
}
public void RemoveNerd()
{
    if (IsTarget)
    {
        MyScore.CurrentNerds -= 1;
        MyScore.PunchedRight += 1;
    }
    else MyScore.PunchedWrong += 1;
}