How do I spawn objects around a planet?

Get help using Construct 2

Post » Wed Dec 23, 2015 7:00 pm

Hi,
i want to add a world generator to my game that spawns objects randomly around planets. The objects should spawn at a specific distance because the planet has a range in which it pulls objects to itself with the platform behaviour.
Here is a screenshot of my game with a planet:
https://drive.google.com/open?id=0B7r2W ... jVtRi0zVEk
The red line shows where the objects should be spawned.
After they are spawned they will be pulled to the planet automatically (If they are touching the atmosphere) so everything i would like to know is how to find the right X and Y coordinates when the objects are spawned.
Thanks! :D
Image
B
5
S
3
Posts: 193
Reputation: 1,063

Post » Wed Dec 23, 2015 7:09 pm

You should look at using parametric circle equations.
https://en.wikipedia.org/wiki/Parametri ... ion#Circle
http://www.mathopenref.com/coordparamcircle.html <--- for generic circle (of arbitrary radius)

Then just spawn it at a random t-value between 0 and 2pi.
https://www.ravenheart.ca/home
Company name changed to avoid Facebook-type shenanigans

"Someone once told me I bite off more than I can chew...

I told them I would rather choke on greatness than nibble on mediocrity."
B
22
S
6
G
1
Posts: 1,365
Reputation: 4,724

Post » Thu Dec 24, 2015 9:23 pm

Thanks I'll have a look at that :)
Image
B
5
S
3
Posts: 193
Reputation: 1,063

Post » Thu Dec 24, 2015 9:59 pm

@gumshoe2029,
Thanks for your help! It works now :)
Thanks again!
Image
B
5
S
3
Posts: 193
Reputation: 1,063

Post » Tue Jan 05, 2016 4:43 pm

Glad to help.
https://www.ravenheart.ca/home
Company name changed to avoid Facebook-type shenanigans

"Someone once told me I bite off more than I can chew...

I told them I would rather choke on greatness than nibble on mediocrity."
B
22
S
6
G
1
Posts: 1,365
Reputation: 4,724

Post » Sat Feb 06, 2016 11:03 pm

Anyone care to share capx example on this one? Thanks!
B
15
S
7
G
34
Posts: 55
Reputation: 18,478

Post » Fri Feb 26, 2016 8:26 pm

@bloodshot,
Here is an example:
https://drive.google.com/open?id=0B7r2W ... 1RyT2R1a2c
I hope it helps! :D
Image
B
5
S
3
Posts: 193
Reputation: 1,063

Post » Fri Feb 26, 2016 9:04 pm

Hi, @aquadijoib! Thank you. That was excellent! How is the game coming btw? Screenshot looks cool. Would love to give it a testdrive. cheers! :)
B
15
S
7
G
34
Posts: 55
Reputation: 18,478

Post » Sat Feb 27, 2016 12:16 pm

@bloodshot I'm glad it helped! I'm currently working on the crafting system for my game. I created a thread for that here on the forum. Also when the game is in a more finished state I would love to send a version to you for testing! :D
Image
B
5
S
3
Posts: 193
Reputation: 1,063


Return to How do I....?

Who is online

Users browsing this forum: ColombageEnPLS, FabianB and 12 guests