
-----------------------------------
Crescendo
Sat May 14, 2011 11:27 am

How do I make curve/semi-circle paths? (Floats to int)
-----------------------------------
What is it you are trying to achieve?
I want to move pictures along my screen by a circle path.


What is the problem you are having?
The x and y values I specify must be integers and by using math to predetermine what the values should be, I get real numbers out of it.
I don't know how to convert floats to nearest integer. :S

Describe what you have tried to solve this problem
Have really no basis for the code as I've just recently started learning Turing functions. Any help would be greatly appreciated. c:

Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
So currently I have my sun and moon moving from east to west by means of a horizontal line. I want to improve it by making the pictures follow a semi circle
using a equation like y := sqrt(r**2 - x**2), and x := x +1. But to do so x and y must be real instead of int. How would I turn the floats I get from the math (using
a different variable) and change them to ints?



sunx := 650
suny := 300
loop
    cls
    daybackground
    Pic.Draw (sun, sunx, suny, picMerge)
    sunx := sunx - 1
    house
    View.UpdateArea (0, 0, maxx, maxy)
    exit when sunx < -100
    delay (50)
end loop

mox := 650
moy := 300
loop
    cls
    nbackground
    Pic.Draw (moon, mox, moy, picMerge)
    mox := mox - 1
    house
    View.UpdateArea (0, 0, maxx, maxy)
    exit when mox < -100
    delay (50)
end loop



Please specify what version of Turing you are using
4.1.1

-----------------------------------
RandomLetters
Sat May 14, 2011 12:37 pm

RE:How do I make curve/semi-circle paths? (Floats to int)
-----------------------------------
round(x)

converts real (float or double) to integers.

-----------------------------------
Raknarg
Sat May 14, 2011 6:31 pm

RE:How do I make curve/semi-circle paths? (Floats to int)
-----------------------------------
Also (in case you ever need them):
floor () - rounds down
ceil () - rounds up

-----------------------------------
Crescendo
Sat May 14, 2011 6:42 pm

Re: How do I make curve/semi-circle paths? (Floats to int)
-----------------------------------
Thanks for all the help :). I've gotten all the formula worked out.
