Hi everyone,
I want to make a “total score” variable. This means adding every single point of score from the player’s first game to their millionth game, as long it’s more than zero.
This will basically be “total gameplay time” as my game Boxwindow counts 1 second = 1 score.
So, What is the maximum number variable value? Like how in Pac-Man for example the 8-bit integer limit is 256 and so the game ends/crashes at that level , because no code was made to avoid crashing after winning level 255.
I believe number variables in GDevelop are float and so the maximum number is 1.7976931348623157e+308 . (No idea how to read that, by the way.)
One can also reference this number by Number.MAX_VALUE in JavaScript.
(source: javascript.plainenglish.io by Casey Gibson )
So what I wanna ask is:
- How do I call this Number.MAX_VALUE in GDevelop event? Is it a function and would be like Number.MAX_VALUE() ?
- What is a good way to handle number overflow?
I’m thinking to make a condition to check if variablemaxScore
+ variablecurrentScore
>Number.MaxValue()
. - Does GDevelop/JavaScript break if I don’t do anything to prevent the number overflow?
Thanks in advance for your interest in this incredibly nerdy question!