need help for my idle Game

soo i have 2 questions i want to ask :
first i have floors and i want a boss apears every 5 lvl my code was this :

function Update()
{
        if(floor == 5 * Random.Range(1, 100))
        {
         //but i dont want it to be random so just calculate if floor is equls 5 or numbers multiplaed by 5
          
         }
}

second one is that i want my gold show in billions and triillions etc
for example if i have 100,000,000 show it as 100M

thats all hope my thread was understandable
thx

EDIT :
also i want to know how to make the game work offline which means that players will keep progressing while offline and get gold etc

2 Likes

Depending on how far you are going to go, one thing to think about: what happens when you’re score is 100,000,000,000,000,000,000,000,000 …? after a while you can’t represent the numbers with just one datatype. You’ll need to work out a way hold the values and doing math with only the most pertinent significant figures. You’ll note with many idle games you only ever handle values within a few 0’s of each other.

okay thanks to fluzing the wiki page you gived me helped
so this is what i typed

if(floor % 5)
    {
        Debug.Log("Normal Enemy");
    }else {
        Debug.Log("Boss Time");
    }

now every 5 floors a boss will come

You are almost there, but you forgot the == 0.

if(floor % 5 == 0)
{
    //do boss time!
}

your code did work too anyway do u know what does the % mean i was wondering

It is the mod operator. It divides the first number with the second one and gives you the remainder.

109 % 20 = 9

but why is the = ?

why you didnt type (floor % 5 == 1) soo if the remainder is 1 then spawn boss
and typed if(floor % 5 == 0) the remainder here == to 1 soo why it did work