Solar System Help?

Get help using Construct 2

Post » Sun Dec 09, 2012 6:19 am

Hi

Im building a little app in which sprites orbit a center object but gain more distance over time.
The speed needs to be correct according to the distance.
(So no superspeed orbits when the sprites are further away from the center object.)
I also need them to move completely sepparate from eachother.
So no matter where i spawn them, they need to start orbiting from that position at the correct speed.
I tried the +cos & +sin math formula but that aligns them in a syncronised order, which is no good.

Can anyone help me on this?
I have tried every possible orbit sollution on the forum but they dont do what i need.
Probably because my coding skills are yet not good enough.

Any help is Super!
Thanx
Savvy001
B
56
S
20
G
13
Posts: 778
Reputation: 13,204

Post » Sun Dec 09, 2012 8:08 am

Solved:

I needed to Rotate towards Angle:
For Each (Sprite)
Rotate Towards Angle
---> Degrees: distance(self.X,self.y,Center.X,Center.Y)
---> Angle:   angle(self.X,self.y,Center.X,Center.Y)+90

Then Move the sprites:
For Each (sprite)
Move Forard Every Tick
--> 20000/distance(self.X,self.Y,Center.X,Center.Y)*dtSavvy0012012-12-09 08:08:59
B
56
S
20
G
13
Posts: 778
Reputation: 13,204

Post » Wed Dec 12, 2012 2:06 pm

Hey @Savvy001, just wanted to say thanks for posting this up! I probably won't use it any time soon, but I really love little mechanics like this. Great for adding minigames or making small projects very quickly and easily.
B
27
S
8
G
5
Posts: 429
Reputation: 6,902

Post » Wed Dec 12, 2012 2:23 pm

Your Welcome!
B
56
S
20
G
13
Posts: 778
Reputation: 13,204

Post » Tue Jan 07, 2014 4:18 pm

@Savvy001 I used your solution and when I observe the planets are moving away from sun with every rotation around the sun. Do you also have this problem?

The way of for example earth lokks likhe that: delgado2014-01-07 16:23:38
B
94
S
19
G
34
Posts: 1,840
Reputation: 27,988

Post » Tue Jan 07, 2014 4:24 pm

[QUOTE=@delgado] Savvy001 I used your solution and when I observe the planets are moving away from sun with every rotation around the sun. Do you also have this problem?

The way of for example earth lokks likhe that: [/QUOTE]


[QUOTE=Savvy001] Hi

Im building a little app in which sprites orbit a center object but gain more distance over time.[/QUOTE]


I think its suposed to do that.
Who dares wins
B
50
S
10
G
10
Posts: 1,728
Reputation: 12,867

Post » Tue Jan 07, 2014 4:41 pm

@lennaert Oh yeah :D you have right hmmm so @Savvy001 if you are author of this example did you have solution for not gain distance over time?
B
94
S
19
G
34
Posts: 1,840
Reputation: 27,988

Post » Mon Jan 13, 2014 7:07 pm

@delgado

This project is put in my refrigerator, so in other words i wil not touch until im satisfied with the direction it needs to go.
As a result i "at this moment" have not any info on how to change the logic u ask for.
I truly need to dive into the project for that.
Maybe in the future, but i hope someone else can help u at this point in space.Savvy0012014-01-13 19:07:39
B
56
S
20
G
13
Posts: 778
Reputation: 13,204

Post » Mon Aug 04, 2014 1:49 am

delgado wrote:@lennaert Oh yeah :D you have right hmmm so @Savvy001 if you are author of this example did you have solution for not gain distance over time?


@delgado - I had a need to do orbits, and using Savvy001's technique, I just changed the 90 to an 85 in the bolded line below and then my objects spiraled into the main center object:

For Each (Sprite)
Rotate Towards Angle
---> Degrees: distance(self.X,self.y,Center.X,Center.Y)
---> Angle: angle(self.X,self.y,Center.X,Center.Y)+90
B
32
S
7
G
8
Posts: 312
Reputation: 8,467

Post » Mon Aug 04, 2014 1:35 pm

@lennaert Podzieliłeś dysk na partycje już? :) @Manley23 its old topic what you need please Remind me what was going on
B
94
S
19
G
34
Posts: 1,840
Reputation: 27,988

Next

Return to How do I....?

Who is online

Users browsing this forum: DemantDigitalArt, Lancifer and 28 guests