Square orbit around moving object

Get help using Construct 2

Post » Sat Aug 02, 2014 8:11 am

I would like to create these "orbits" around a center sprite.

The Center will move just like how you can touch move the center in the circle example, I've seen the circle and square movement patterns on Scirra Forums. These.capx are not my creations! The .png is though!

Here's a nifty picture of what I hope to do! I really appreciate the help!
You do not have the required permissions to view the files attached to this post.
B
18
S
8
G
1
Posts: 56
Reputation: 2,018

Post » Sat Aug 02, 2014 9:58 am

You could use this https://dl.dropboxusercontent.com/u/577 ... oveto.html

Then you just need to ensure your 3 x,y co-ords ( for triangle) or 4 x,y co-ords for rectangle are always set in relation to the center point.
B
49
S
16
G
9
Posts: 1,098
Reputation: 11,222

Post » Sat Aug 02, 2014 6:40 pm

@spongehammer

I don't understand how to do what you've said. I don't have a 7zip program. What type of file is that?
B
18
S
8
G
1
Posts: 56
Reputation: 2,018

Post » Sun Aug 03, 2014 6:48 am

I am still stuck after trying some path finding stuff. Can anyone tell me how to do this specific circular movement, but as square movement.

If you test it you will see why pathfinding doesn't work. This example is exactly what I want except for a square. I don't actually get why it works. I was surprised to see the sin and cosine.
You do not have the required permissions to view the files attached to this post.
B
18
S
8
G
1
Posts: 56
Reputation: 2,018

Post » Sun Aug 03, 2014 10:35 am

Image
B
27
S
9
G
5
Posts: 488
Reputation: 11,948

Post » Sun Aug 03, 2014 10:39 am

Do you mean like this
You do not have the required permissions to view the files attached to this post.
B
255
S
39
G
15
Posts: 1,982
Reputation: 41,005

Post » Sun Aug 03, 2014 1:17 pm

@Lordshiva1948
No I mean just like in this example. Except I want a square. The problem with path finding is that if I move the path the pathfinder looks for the old path not something new and constantly changing.

@Johnnysix
Your site won't load on my comp because it says adult content. Could you just load the capx download?
You do not have the required permissions to view the files attached to this post.
B
18
S
8
G
1
Posts: 56
Reputation: 2,018

Post » Sun Aug 03, 2014 2:14 pm

there is nothing there that it should say adult content
You do not have the required permissions to view the files attached to this post.
B
255
S
39
G
15
Posts: 1,982
Reputation: 41,005

Post » Sun Aug 03, 2014 9:25 pm

@JohnnySix @Lordshiva1948 - I have looked at your examples and at others on the forum. All the examples I found are for one orbiting body. How do you allow for many orbiting bodies? If I add more red balls in JohnnySix's example, all the balls orbit in the same position. Thanks in advance.

EDIT: nevermind, figured it out from this thread: https://www.scirra.com/forum/viewtopic.php?f=147&t=76729&p=634604&hilit=planets+orbit+sun#p634604

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)+85

Then Move the sprites:

For Each (sprite)
Move Forward 1 pixel
B
33
S
7
G
8
Posts: 312
Reputation: 8,528

Post » Mon Aug 04, 2014 6:09 am

@Lordshiva1948 @JohnnySix @Manely23

I was able to get the download JohnnySix gave. it is perfect! Thank you all so much!!

Case SOLVED
B
18
S
8
G
1
Posts: 56
Reputation: 2,018

Next

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 31 guests