Why isn't this number increasing AND why are the numbers weird?

When “Red Crystal” gets to (0.7) in what you currently have. It stops increasing.

In this case “howMany_Miner” = 1 and “redCrystal_PerMiner” = 0.1
1 * 0.1 = 0.1
0.1 + 0.1…etc to 0.7 where it just stops.
This trunc is supposed to make it look clean, eg:

Instead of this:
Don’t really know why it is happening either, since it should just be 0.1000000000000
and not 0.10000000004 or something like that.

/Sincerely, Voxel

hi. I don’t know the answer to your questions. I’m not a programmer, I’m not good at math, and I’m not an expert GDevelop user. so this is just an advice. work with integers. floats unnecessarily complicate things. I think it isn’t difference in the proportions when 0.1/sec is produced and a building needs 60, or 1/sec is produced and needs 600 for the same building. it is 10 minutes anyway. but I think your job will be easier. I dont know what is this “trunc”, but with integers you can use a simply “round()” if it required.

so, this is just an advice. I’m sure there is answer to your questions. there is a reason why it works like that, and it has a solution to your issue.

1 Like

You have 2 questions here:

  1. Why does the Red Crystal counter only to 0.7?
  2. Why does the Red Crystal display as 1.0999999, and not 1 dp?

The answer to question 1 I suspect lies elsewhere in your code. The code snapshot you’ve provided for Stone and Red Crystal seem to do the same thing, so it suggests the error is created elsewhere. Search for redCrystal and see where in your code you are modifying or restricting it.

The answer to question 2 will be similar. There will be somewhere in your ‘code’ that you alter the global variable redCrystal to lose the 1 dp. Instead, how about using the trunc command when you set the textObject’s text value?