Log In  
Follow
Tecnology_Wizz
[ :: Read More :: ]

So I'm trying to make a idle game and im using a timer that resets to 0 every 30 cycles to make a 1 second timer, my goal is to make the total number increase by 0.2 every second but after a wile it increases by 0.1999 instead and I have no idea why

heres my code:
function _init()
timer=0
counter=0
end

function _update()
if timer==30 then timer=0 end
if timer==0 then counter+=0.2 end

timer+=1

end

function _draw()
cls()
print("timer:",0,0)
print(timer,24,0)
print("counter:",0,7)
print(counter,32,7)
end

P#125604 2023-02-09 19:42 ( Edited 2023-02-09 19:46)