Computer Science Canada Calculation of a ball move to a certain coordinate. |
Author: | 8749236 [ Tue Mar 08, 2011 1:25 pm ] | ||
Post subject: | Calculation of a ball move to a certain coordinate. | ||
What is it you are trying to achieve? I'm trying to write a program, it will draw a ball, and move it to any coordinate What is the problem you are having? i got calculation problem, i don't know how to do the calculation to make the ball move to the coordinate i want Describe what you have tried to solve this problem i have tried to calculate the slope between the ball's coordiante and the target's coordinate, but the mostly the numbers don't have a GCF.. Post any relevant code (You may choose to attach the file instead of posting the code if it is too long) <Answer Here>
Please specify what version of Turing you are using Turing 4.1 |
Author: | DemonWasp [ Tue Mar 08, 2011 2:06 pm ] |
Post subject: | RE:Calculation of a ball move to a certain coordinate. |
You want to use the real variable type. This will let you represent numbers like 1.2, 3.1415, or 0.1113. You can then represent your slope was a "real" variable. You will also need to look at the round(), floor() or ceil() functions to convert real numbers back into integers for drawing coordinates. |
Author: | Grim [ Tue Mar 08, 2011 7:12 pm ] |
Post subject: | RE:Calculation of a ball move to a certain coordinate. |
There are common algorithms that compute the shortest path between two points. |
Author: | 8749236 [ Wed Mar 09, 2011 10:27 am ] |
Post subject: | RE:Calculation of a ball move to a certain coordinate. |
ok.. i'll try... and.. what is 'floor' and 'ceil' function? |
Author: | DemonWasp [ Wed Mar 09, 2011 10:34 am ] |
Post subject: | RE:Calculation of a ball move to a certain coordinate. |
Look them up in the Turing help. |