Quote: "integers are being converted to floats before they are used in calculations, and then back again afterwards"
I'd be very surprised if it was doing this. It is not efficient.
If the code looks like this:
SetVirtualResolution(480, 320)
SetPrintSize(16)
global CurrentTime as float
global CheckTime as float
global RandomSpeed as integer = 20
global UseSpeed as float
// initialise the time
CheckTime = Timer() + 0.05
do
CurrentTime = Timer()
Print(RandomSpeed)
if RandomSpeed < 100
if CurrentTime > CheckTime
rem update the speed
INC RandomSpeed, 5
rem get the speed in floating point
UseSpeed = RandomSpeed / 100.0
rem update the time to check again
CheckTime = CurrentTime + UseSpeed
endif
elseif RandomSpeed = 100
Print("This is good")
endif
rem do something with it
Sync()
loop
Then the RandomSpeed will stay only as an integer. When it is used to create the floating point value, a temporary float is created, the actual variable should not be touched.
Moving the check time calculation the way I did means it does not get done every check, only when the new time is reached.
Comparisons on integer values are much faster, so the checks on the integer RandomSpeed value happen faster. And using the INC command is also faster, no temporary variable is used to do the calculation before assigning it back to RandomSpeed.
But, I could be wrong about integers being actually stored as floats. I don't know how the AppGameKit core Tier 1 compiler works. Certainly, if you are in Tier 2, nothing like that happens at all.
Cheers,
Ancient Lady
AGK Community Tester