Page 1 of 1

Converting real to nearest whole no. int

PostPosted: Tue Sep 08, 2009 1:58 pm
by poopbrigade
(>,<)...hello again.


Um, how do you convert a real number to nearest whole number in GE like,
1234.567___to____1235.000
Ive got an idea but I think there's an easier way though.


:mrgreen: thanx in advance :mrgreen:

Re: Converting real to nearest whole no. int

PostPosted: Tue Sep 08, 2009 2:48 pm
by pyrometal
ceil(); rounds up
floor(); rounds down
round(); rounds to nearest int

Re: Converting real to nearest whole no. int

PostPosted: Wed Sep 09, 2009 10:58 am
by poopbrigade
hey do you also know how to re size an actor in GE.?

Re: Converting real to nearest whole no. int

PostPosted: Wed Sep 09, 2009 9:38 pm
by Rux
There is a way, but it is kind of tricky. It involves a canvas actor. On the draw actor canvas,
Code: Select all
draw_from("player", 0, 1, 1.0);

This will draw your actor which is "player" and place it at 0 x 1 y on the canvas and rezise it by 1.0.
You need to have a regular size version of the actor to use too. This code is good for static animations, but for animated ones, you need to use the erase function. (IDK how to use that)

Re: Converting real to nearest whole no. int

PostPosted: Thu Sep 10, 2009 12:02 am
by poopbrigade
thanx anyways, (>,<) I'm not that familiar of some of the functions yet but I'll try my best in understanding it.(>,<)