# Changing size of the player problems

I’m currently making a simulator game where you eat food to become bigger and bigger. Though I’m having problems with the sizes. I want it so that the size of the player is equivalent to the fatness you have. But if I were to just set the size to how much fatness you have, you would’ve become to big. I solved 1 issue, but then another one came. Sorry if my math or scripts really suck.

Edit: The result I want is those simulator games like Munching Masters Simulator
Edit 2: If you were wondering, I have been playing around and testing different values. None of them seem to work well.

Script:

Fatness 0 (default and perfect)

Fatness 100 (too small)

Fatness 10000 (not the best)

Fatness 100000 (way to big)

The less than 500 is fine, but after you hit 1000 the player size is too big. How would I fix this?

2 Likes

Do you mean you want it to increase quickly in the beginning when you increase by 1000, but later when your size is already big you want the increments to be less?

2 Likes

Yes! That’s the exact result I would like.

1 Like

You could try using `math.log` or any other variation of it like `math.log10`.

This math function decrements its increment as the value passed grows, which may be what you want, though the value of this function can be negative, so you’d have to do a few changes to it.

You could also use `math.sqrt`, which slowly decreases its increment as the value passed grows, in this case the value of the function is never negative.

If you don’t wanna use any of those options, you could do a simple condition chain to change how the size is calculated depending on how much fatness you have, example:

``````if fatness > 100 then
-- Formula to grow fast
else if fatness > 10000 then
-- Formula to grow slower
-- ...
end
``````
2 Likes

math.log seemed to work very well! Thanks! I also combined math.sqrt and math.log to get better results.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.