How do I assign new user coordinates?

0 favourites
  • 6 posts
From the Asset Store
Create your game with this complete pack of images and animations!
  • 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.

    Thanks in advance for your help.

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

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

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Around a middle (0,0) that is a circle.

    Cartesian for a circle =

    x= a * cos(angle)

    y= a * sin(angle)

    a = radius

    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.

  • 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

  • Thanks for your time 99Instances2Go. I was on this trail too, thanks to very old Trigonometry books, and Stack Overflow.

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