How do I assign new user coordinates?

Get help using Construct 2

» Mon Apr 03, 2017 8:07 pm

I want to assign users to coordinates on a map as they create an account.
Earlier account creators will be near the middle.
Later accounts and re-spawns will be placed at the periphery, so that the players are placed in an ever widening circle.

B
30
S
5
G
4
Posts: 29
Reputation: 5,253

» Mon Apr 03, 2017 8:52 pm

Simple solution off the top of my head - if you're keeping track of the user accounts, have their spawn location coordinates multiplied by their chronological order number.
B
55
S
28
G
115
Posts: 1,709
Reputation: 65,116

» Mon Apr 03, 2017 9:00 pm

oosyrag wrote:Simple solution off the top of my head - if you're keeping track of the user accounts, have their spawn location coordinates multiplied by their chronological order number.

Interesting... thanks.

But, i don't think that accomplishes what I'm trying to do.
B
30
S
5
G
4
Posts: 29
Reputation: 5,253

» Mon Apr 03, 2017 10:29 pm

Around a middle (0,0) that is a circle.

Cartesian for a circle =
x= a * cos(angle)
y= a * sin(angle)

So, if you wanna place them on a circle around the middle(0,0), just add a certain degrees to angle each time an account is created, and you know x and y. How much you want to add depends on the needed space. Say the space needed is a circle with diameter b.

Then the first circle describing the first round around the middle must have at least radius a = b*6 (i think)
Now you add 360/ (round((pi*2*a) / b)) every time an account registers to angle.
When that circle is full, you add b to a.
And again you add 360/ (round((pi*2*b) / d)) every time an account registers, until again also that circle is full.
When that circle is full, you add b to a. ... and so on

But, that is kinda mimicking a spiral.

Cartesian for a simple spiral =
x= (a + (b*angle)) * (cos(angle))
y= (a + (b*angle)) * (sin(angle))

a kinda says where you start from the middle, while b controls the distance between successive turnings…

Now again, just add a value to angle, and you know x and y.
I just dont know how much degrees in this case. Guess you got to find that yourself or ask a smarter dude then me.
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

» Mon Apr 03, 2017 11:43 pm

But then again. Say we start with 1 square in the middle. And we want to seamless add squares in a spiralling way. like 1 right, 1 down, 2 left, 2 up, 3 right, 3 down, .......... and so on.

https://www.dropbox.com/s/sb2cd4plkskqv ... s.c3p?dl=0
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

» Tue Apr 04, 2017 12:35 pm

Thanks for your time 99Instances2Go. I was on this trail too, thanks to very old Trigonometry books, and Stack Overflow.
B
30
S
5
G
4
Posts: 29
Reputation: 5,253