Counting a circle path

Posted:
Sat Oct 20, 2007 10:37 am
by Troodon
I'm trying to write a code system that would count this kind of orbiting around center of the game (or later another actor).
This should be dynamic but Inc = 1 is ok for the moment. (no periapsis/apoapsis) This could be used for example to simulate map rotation (360 degrees) without C++.
However because I haven't studied extra-math this may take months for me. Has someone ideas?
Re: Counting a circle path

Posted:
Sun Oct 21, 2007 3:56 am
by Fuzzy
You want to calculate points on a circle on the fly or something else?
Re: Counting a circle path

Posted:
Sun Oct 21, 2007 4:26 pm
by Troodon
Well, I would like the actor to follow the imaginary circle path...in the fly.

Re: Counting a circle path

Posted:
Mon Oct 22, 2007 4:13 am
by Fuzzy
Easily done!
First, you will need a step size variable. you might just choose this, or you might calculate it as a fraction of the circle. If the number is too large, it will have the circle drawn with flat faces. If its too small, you will end up calculating to often, to the detriment of your script. [edit] this should be expressed in radians. [/edit]
If the size of the circle is going to vary, then you should calculate it when you know the size of the circle.
Next you need the radius of the circle. Store in a cool dry place for now.
Take the angle of the actor from the center point(as if it were (0, 0)). if need be, store the center point in a variable and then subtract it from itself to get zero zero.
take this angle(make sure its in radians, not decimals) and do this
Make a loop from 0.0 to 1.0(I tend to use i)
in the loop, use this
Xoffset = radius*cos(angle+(stepsize*i));
Yoffset = radius*sin(angle+(stepsize*i));
END LOOP
Now add back the stored center point to the Xoffset and YOffset and you have your actors location.
thats it.
I should add that its not layed out in a GE sorta way. you would likely do this in the draw event, so your loop would simply be a counter that is from 0.0 to 1.0 wrapping around
Re: Counting a circle path

Posted:
Mon Oct 22, 2007 8:25 am
by Troodon
Thanks T.F.Pete!
I will try to do that in GE and ask if there is something I didn't understand.
In the meantime, here is a score.

Re: Counting a circle path

Posted:
Thu Oct 25, 2007 5:27 am
by Fuzzy
Did you get it going tek?
Re: Counting a circle path

Posted:
Thu Oct 25, 2007 1:06 pm
by Troodon
Well, I haven't got time to try it yet. I've been too busy to even open Game Editor.
(I made myself in my countries rap championship final which will be 3rd november)
Re: Counting a circle path

Posted:
Thu Oct 25, 2007 5:09 pm
by Bee-Ant
Yeah cool...(because i don't know anything)
Re: Counting a circle path

Posted:
Sat Oct 27, 2007 12:48 pm
by Kalladdolf
Bee-Ant wrote:Yeah cool...(because i don't know anything)
because I don't understand any of that
don't try to explain, I'll have to look at the stuff more closely
Re: Counting a circle path

Posted:
Wed Oct 31, 2007 1:17 pm
by Bee-Ant
==Kalladdolf== wrote:Bee-Ant wrote:Yeah cool...(because i don't know anything)
because I don't understand any of that
don't try to explain, I'll have to look at the stuff more closely
So we guys are stupid in coding...

Re: Counting a circle path

Posted:
Thu Nov 01, 2007 8:33 am
by Kalladdolf
that's a terrible thing to say!
let's just say, we are not quite ready yet
I'll have to occupie myself more with it.
Re: Counting a circle path

Posted:
Thu Nov 01, 2007 9:53 pm
by Fuzzy
==Kalladdolf== wrote:that's a terrible thing to say!
let's just say, we are not quite ready yet
I'll have to occupie myself more with it.
Thats the perfect way to put it. I have no doubt that you guys will become excellent programmers!
Re: Counting a circle path

Posted:
Fri Nov 02, 2007 4:20 pm
by Kalladdolf
The problem for me is that everything is in english; I don't know those "proffesional exressions".
Do u have to be good at math to be a good programmer?