Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers AppGameKit Corner / Rounding down a real number

Author
Message
Doveyy04
6
Years of Service
User Offline
Joined: 30th Apr 2012
Location:
Posted: 29th Jan 2019 19:23 Edited at: 29th Jan 2019 19:48
I’m using a real number as a variable but also wish to convert the decimal point amount to another variable so for example I have gametime#=1.75 and I want the 0.75 to another variable. The thing is when I say for instance gametime2=gametime# then gametime2=2 because it’s rounded up so is there a way to return a value ‘rounded down’ to 1?
Doveyy04
6
Years of Service
User Offline
Joined: 30th Apr 2012
Location:
Posted: 29th Jan 2019 19:48
Actually what I’ve done is

If gametime2>gametime# then gametime2=gametime2-1
blink0k
AGK Developer
Gold Codemaster
6
Years of Service
Recently Online
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 29th Jan 2019 20:35
you could try
fmod(gametime#, 1)
Increase
2
Years of Service
User Offline
Joined: 21st Feb 2017
Location:
Posted: 29th Jan 2019 21:26
gametime2# = gametime1# - trunc(gametime1#)

Login to post a reply

Server time is: 2019-04-19 02:32:17
Your offset time is: 2019-04-19 02:32:17