Counting a circle path

You must understand the Game Editor concepts, before post here.

Counting a circle path

Postby Troodon » Sat Oct 20, 2007 10:37 am

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?
Attachments
circlepath.jpg
I can't die, I already tried
~on the forums since GE 1.3.3~
User avatar
Troodon
 
Posts: 1539
Joined: Thu Jan 12, 2006 3:29 pm
Location: HELL
Score: 56 Give a positive score

Re: Counting a circle path

Postby Fuzzy » Sun Oct 21, 2007 3:56 am

You want to calculate points on a circle on the fly or something else?
Mortal Enemy of IF....THEN(and Inspector Gadget)

Still ThreeFingerPete to tekdino
User avatar
Fuzzy
 
Posts: 1068
Joined: Thu Mar 03, 2005 9:32 am
Location: Plymostic Programmer
Score: 95 Give a positive score

Re: Counting a circle path

Postby Troodon » Sun Oct 21, 2007 4:26 pm

Well, I would like the actor to follow the imaginary circle path...in the fly. :)
I can't die, I already tried
~on the forums since GE 1.3.3~
User avatar
Troodon
 
Posts: 1539
Joined: Thu Jan 12, 2006 3:29 pm
Location: HELL
Score: 56 Give a positive score

Re: Counting a circle path

Postby Fuzzy » Mon Oct 22, 2007 4:13 am

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
Last edited by Fuzzy on Thu Oct 25, 2007 8:15 pm, edited 3 times in total.
Mortal Enemy of IF....THEN(and Inspector Gadget)

Still ThreeFingerPete to tekdino
User avatar
Fuzzy
 
Posts: 1068
Joined: Thu Mar 03, 2005 9:32 am
Location: Plymostic Programmer
Score: 95 Give a positive score

Re: Counting a circle path

Postby Spidy » Mon Oct 22, 2007 6:55 am

WOOAAAAAW! :shock: :o thats cool Fuzzy :) :D
Image
VOTE FOR MY SIGNATURE PLEASE.......THANK YOU
User avatar
Spidy
 
Posts: 935
Joined: Tue Aug 14, 2007 1:28 pm
Location: http://www.inatonibai.com
Score: 38 Give a positive score

Re: Counting a circle path

Postby Troodon » Mon Oct 22, 2007 8:25 am

Thanks T.F.Pete!
I will try to do that in GE and ask if there is something I didn't understand.
:D

In the meantime, here is a score. :)
I can't die, I already tried
~on the forums since GE 1.3.3~
User avatar
Troodon
 
Posts: 1539
Joined: Thu Jan 12, 2006 3:29 pm
Location: HELL
Score: 56 Give a positive score

Re: Counting a circle path

Postby Fuzzy » Thu Oct 25, 2007 5:27 am

Did you get it going tek?
Mortal Enemy of IF....THEN(and Inspector Gadget)

Still ThreeFingerPete to tekdino
User avatar
Fuzzy
 
Posts: 1068
Joined: Thu Mar 03, 2005 9:32 am
Location: Plymostic Programmer
Score: 95 Give a positive score

Re: Counting a circle path

Postby Troodon » Thu Oct 25, 2007 1:06 pm

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)
I can't die, I already tried
~on the forums since GE 1.3.3~
User avatar
Troodon
 
Posts: 1539
Joined: Thu Jan 12, 2006 3:29 pm
Location: HELL
Score: 56 Give a positive score

Re: Counting a circle path

Postby Bee-Ant » Thu Oct 25, 2007 5:09 pm

Spidy wrote:WOOAAAAAW! :shock: :o thats cool Fuzzy :) :D

Yeah cool...(because i don't know anything)
User avatar
Bee-Ant
 
Posts: 3723
Joined: Wed Apr 11, 2007 12:05 pm
Location: http://www.instagram.com/bee_ant
Score: 210 Give a positive score

Re: Counting a circle path

Postby Kalladdolf » Sat Oct 27, 2007 12:48 pm

Bee-Ant wrote:
Spidy wrote:WOOAAAAAW! :shock: :o thats cool Fuzzy :) :D

Yeah cool...(because i don't know anything)

because I don't understand any of that :roll:
don't try to explain, I'll have to look at the stuff more closely
User avatar
Kalladdolf
 
Posts: 2427
Joined: Sat Sep 08, 2007 8:22 am
Location: Germany
Score: 120 Give a positive score

Re: Counting a circle path

Postby Bee-Ant » Wed Oct 31, 2007 1:17 pm

==Kalladdolf== wrote:
Bee-Ant wrote:
Spidy wrote:WOOAAAAAW! :shock: :o thats cool Fuzzy :) :D

Yeah cool...(because i don't know anything)

because I don't understand any of that :roll:
don't try to explain, I'll have to look at the stuff more closely

So we guys are stupid in coding... :lol:
User avatar
Bee-Ant
 
Posts: 3723
Joined: Wed Apr 11, 2007 12:05 pm
Location: http://www.instagram.com/bee_ant
Score: 210 Give a positive score

Re: Counting a circle path

Postby Kalladdolf » Thu Nov 01, 2007 8:33 am

that's a terrible thing to say!
let's just say, we are not quite ready yet :D

I'll have to occupie myself more with it.
User avatar
Kalladdolf
 
Posts: 2427
Joined: Sat Sep 08, 2007 8:22 am
Location: Germany
Score: 120 Give a positive score

Re: Counting a circle path

Postby Fuzzy » Thu Nov 01, 2007 9:53 pm

==Kalladdolf== wrote:that's a terrible thing to say!
let's just say, we are not quite ready yet :D

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!
Mortal Enemy of IF....THEN(and Inspector Gadget)

Still ThreeFingerPete to tekdino
User avatar
Fuzzy
 
Posts: 1068
Joined: Thu Mar 03, 2005 9:32 am
Location: Plymostic Programmer
Score: 95 Give a positive score

Re: Counting a circle path

Postby Kalladdolf » Fri Nov 02, 2007 4:20 pm

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?
User avatar
Kalladdolf
 
Posts: 2427
Joined: Sat Sep 08, 2007 8:22 am
Location: Germany
Score: 120 Give a positive score

Re: Counting a circle path

Postby Bee-Ant » Tue Nov 06, 2007 8:44 am

==Kalladdolf== wrote:The problem for us is that everything is in english

Uh-Huh...
User avatar
Bee-Ant
 
Posts: 3723
Joined: Wed Apr 11, 2007 12:05 pm
Location: http://www.instagram.com/bee_ant
Score: 210 Give a positive score

Next

Return to Advanced Topics

Who is online

Users browsing this forum: No registered users and 1 guest