Hello, thanks for visiting GameML, if you are a Game Maker user, this is the site for you, please sign up, or login if you are already a member, or just browse the site! Welcome to GameML!

ATTENTION MEMBERS!!! USERS CAN NOW SIGN UP AGAIN!
Log in

I forgot my password

Search
 
 

Display results as :
 


Rechercher Advanced Search

Site Hits
Free hit counter
These stats started at 0 on July 7th 2009
GameML File Sharing
USERNAME: gamemladmin@gmail.com PASSWORD: gamemlsite Upload Here: http://gameml.iowoi.org/GameML-File-Sharing-h3.htmPlease add only games.
Create A GAMEML BLOG!
Make a Blog on GameML:http://gamemlblogs.wetpaint.com
Keywords


Rounding variables??

View previous topic View next topic Go down

Rounding variables??

Post by The Puppet Master on Thu Jun 25, 2009 5:24 pm

How do I round a variable?

Like if a variable is 1.2 how do I round that to 1?
avatar
The Puppet Master
Game5L
Game5L

Posts : 471
Points : 31131
GameML Reputation : 4
Join date : 2009-06-03
Age : 23
Location : Valhalla

View user profile

Back to top Go down

Re: Rounding variables??

Post by CarnivorousA on Thu Jun 25, 2009 5:26 pm

I suppose you could try something like
if variable is less than 1.5 then
variable = 1
if variable is more than 1.5 then
variable = 2
etc.

Probably not the best choice but whatever.

_________________
avatar
CarnivorousA
Moderator
Moderator

Posts : 1402
Points : 32552
GameML Reputation : 17
Join date : 2009-06-01
Age : 23
Location : At the bottom of the lake.

View user profile http://entertainmypeople.freeforums.org/index.php

Back to top Go down

Re: Rounding variables??

Post by The Puppet Master on Thu Jun 25, 2009 5:37 pm

I want the variable to change though, and every time it changes it gets rounded
avatar
The Puppet Master
Game5L
Game5L

Posts : 471
Points : 31131
GameML Reputation : 4
Join date : 2009-06-03
Age : 23
Location : Valhalla

View user profile

Back to top Go down

Re: Rounding variables??

Post by Hepolite on Fri Jun 26, 2009 2:18 am

floor(x) Rounds down
round(x) Rounds to closes whole number
ceil(x) Round up
avatar
Hepolite
GameML Noob
GameML Noob

Posts : 23
Points : 30647
GameML Reputation : 12
Join date : 2009-06-03
Age : 24
Location : Land far, far away from the land far, far awaay

View user profile

Back to top Go down

Re: Rounding variables??

Post by CarnivorousA on Fri Jun 26, 2009 5:12 am

Yeah listen to him he knows what he's doing.

_________________
avatar
CarnivorousA
Moderator
Moderator

Posts : 1402
Points : 32552
GameML Reputation : 17
Join date : 2009-06-01
Age : 23
Location : At the bottom of the lake.

View user profile http://entertainmypeople.freeforums.org/index.php

Back to top Go down

Re: Rounding variables??

Post by The Puppet Master on Fri Jun 26, 2009 1:31 pm

ok thanks
avatar
The Puppet Master
Game5L
Game5L

Posts : 471
Points : 31131
GameML Reputation : 4
Join date : 2009-06-03
Age : 23
Location : Valhalla

View user profile

Back to top Go down

Re: Rounding variables??

Post by Sponsored content


Sponsored content


Back to top Go down

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum