Solar System Help?

0 favourites
  • 15 posts
From the Asset Store
Game with complete Source-Code (Construct 3 / .c3p) + HTML5 Exported.
  • 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

  • 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)*dt

  • 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.

  • Your Welcome!

  • 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: <img src="https://dl.dropboxusercontent.com/u/44710358/earth.JPG" border="0" />

  • 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: <img src="https://dl.dropboxusercontent.com/u/44710358/earth.JPG" border="0" />

    Hi

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

    I think its suposed to do that.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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

    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.

  • lennaert Oh yeah 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

  • lennaert Podzieliłeś dysk na partycje już? its old topic what you need please Remind me what was going on

  • delgado - yes, I didn't know if you still needed help on Savvy001's solution, but you had a question on how to stop the spiraling units from going away from center body. It was as simple as changing the 90 to an 85 as I wrote above.

  • i really want to help you but my english is not very well to explain something to somebody. Maybe attach a capx with problem ?

  • i really want to help you but my english is not very well to explain something to somebody. Maybe attach a capx with problem ?

    delgado - oh, I think there is a misunderstanding. I don't need any help on this problem anymore. I thought YOU needed the help, or at least you did at one point. I am good on this, thanks anyway.

  • Use polar coordinates instead of just rotate and move. When you rotate and move those steps don't happen simultaneously, so the position will be incorrectly set sometimes.

    This example uses polar coordinates for both automated and control dependent motion:

    [attachment=0:3iy04k1g][/attachment:3iy04k1g]

    Use LEFT and RIGHT to rotate moons

  • Maybe in your solar system example you don't need the planet to rotate itself, in that case just exclude the rotate clockwise or counter-clockwise actions...

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)