Page 1 of 2

### [PLUGIN]Orbiter Behavior

Posted: Thu Jun 18, 2009 1:26 am
[size=150:3vqdssms]Orbiter Behavior[/size:3vqdssms]:

Version: 1.0

NOTE: I suggest reading the below description/documentation before use. There are is also an example at the bottom.

What does this plugin do? - This is a behavior which can be added to object to make them orbit another object. This usually takes a small bit of complex math, but the Orbiter behavior takes all the math out and provides speed improvements over doing it with events.

What features does it have? - You can change many orbit options, including speed, maximum X distance, maximum Y distance, the angle of the orbit, and the step of the orbit. You can also retrieve all of these values at runtime, including the current distance between the orbiter and the orbited. See below for a complete list of parameters, actions, and expressions.

Parameters:

- Speed: Set the starting speed of the orbit in pixels-per-second.

- X-Distance: Set the starting, maximum X distance of the orbit.

- Y-Distance: Set the starting, maximum Y distance of the orbit.

- Angle: Set the starting angle of the orbit.

- Start step: Set the starting step in the orbit from 0-360. If the starting step is set to 90, the object will start out one quarter of the way through it's initial orbit.

Actions:

- Set Object to Orbit: Set the object that the orbiter will orbit. This only has to be set once.

- Set Orbit Distance: Set the maximum X and Y orbit distances at the same time using ONE value, setting both settings to the same amount.

Expressions:

- Get Orbit Distance: Get the current distance from the orbiter to the orbited. If the maximum X and Y orbit distances are the same, this value will be constant.

Shared Actions/Expressions:

- Set/Get Orbit Speed: Set/get the current speed of the orbit.

- Set/Get Max X-Distance: Set/get the maximum X distance of the orbit.

- Set/Get Max y-Distance: Set/get the maximum Y distance of the orbit.

- Set/Get Orbit Angle: Set/get the angle of the orbit.

- Set/Get Orbit Step: Set/get the current step of the orbit.

Installation: To install the plugin, simply extract the the contents of the ZIP file into the main Construct folder.

Example(s):

Orbiter Behavior - Example File

So there you have it. I've actually been sitting on this plugin for a few days waiting for the finished plugins board to go up. As usual, be sure to leave your comments and ideas here.

### Re: [PLUGIN]Orbiter Behavior

Posted: Thu Jun 18, 2009 10:26 am
Amazing! This will be very useful!

### Re: [PLUGIN]Orbiter Behavior

Posted: Thu Jun 18, 2009 11:16 am

### Re: [PLUGIN]Orbiter Behavior

Posted: Thu Jun 18, 2009 11:45 am
[quote="linkman2004":uejy72q5]provides speed improvements over doing it with events.[/quote:uejy72q5]
Oh comon this is negligible.

Nice plugin anyways, twill help the less mathy people.

ACTAULLY ITS BAD FOR SOCIETY, NOW THEY WILL NEVER LEARN WHAT SIN AND COS PROPERLY DO ARGHHHHHHHHHHH DESTROY IT DESTROY IT

### Re: [PLUGIN]Orbiter Behavior

Posted: Thu Jun 18, 2009 12:14 pm
If you use optimized asm routines for sincos the speed dif over events would be fairly big.

### Re: [PLUGIN]Orbiter Behavior

Posted: Thu Jun 18, 2009 2:01 pm
Hm, how can I set the "Orbit to Object" object to another instance of the same sprite?

I want:

sprite with uid = 0

to orbit around

sprite with uid = 1

### Re: [PLUGIN]Orbiter Behavior

Posted: Thu Jun 18, 2009 2:38 pm
Thanks for the comments, guys. By the way, I'm just wondering, would anybody rather see the speed in degrees-per-second?

[quote="Davioware":1tb4uyca]Oh comon this is negligible. [/quote:1tb4uyca]

For normal applications, yes, but it actually takes 50% more objects with the behavior to slow the game down to VSync rate. That's 4000 objects with events and 6000 objects with the behavior.

[quote="SuperV":1tb4uyca]Hm, how can I set the "Orbit to Object" object to another instance of the same sprite?

I want:

sprite with uid = 0

to orbit around

sprite with uid = 1[/quote:1tb4uyca]

You're on the right track, but it would best to use a private variable so each object can hold a sequential ID. Here's an example.

### Re: [PLUGIN]Orbiter Behavior

Posted: Thu Jun 18, 2009 8:29 pm
[quote="linkman2004":3crj8si7]For normal applications, yes, but it actually takes 50% more objects with the behavior to slow the game down to VSync rate. That's 4000 objects with events and 6000 objects with the behavior.
[/quote:3crj8si7]

### Re: [PLUGIN]Orbiter Behavior

Posted: Fri Jun 19, 2009 6:03 pm
Hehe, excellent! I could probably do the maths myself, but this is faster (slightly) and it's much neater to just slap a behavior on something

Besides, at the moment it's excellent to get any third-party plugins at all, and finally, and most importantly, it has a nice icon that fits with the others \o/

Anyway, excellent job Sir. Hope to see more plugins from you!

### Re: [PLUGIN]Orbiter Behavior

Posted: Wed Jul 22, 2009 7:06 pm
[quote="linkman2004":1asrs3zc]Thanks for the comments, guys. By the way, I'm just wondering, would anybody rather see the speed in degrees-per-second?[/quote:1asrs3zc]
That could be useful, but the current speed setting (in px per second, I assume) is also useful. Can we have both?