Sprites with circular/radial movement and its generation

  • Hi, you all!

    I have different sprites inside a Family and my idea is to generating them endlessly, in a random order (with different distances between one and another for each new instance of them) and following and "invisible curve path".

    Here I let you a pair of sketches I made to understand it much better.

    I want to create something like this:

    i.imgur.com/waGpqja.png

    But this is what I'm getting until now:

    i.imgur.com/I92SfP6.png

    I have managed to create the endlessly generation of the sprites, but with the same distance between them, and I pinned them to an invisible point (like the green circle of the pictures) which is rotating counter-clockwise, but the result is the second image scene...

    So I want to know the best way to do it, because the angle of the sprites it's not mantaining the circular "path" and the distance between all of them is always the same.

    Thank you in advance!

  • Just set the correct angle before pinning. You can try "Set angle towards GreenSprite" and then "Rotate 90 degrees counterclockwise".

    Or "Set angle to (angle(Self.x, Self.y, GreenSprite.x, GreenSprite.y)-90)"

  • Just set the correct angle before pinning. You can try "Set angle towards GreenSprite" and then "Rotate 90 degrees counterclockwise".

    Or "Set angle to (angle(Self.x, Self.y, GreenSprite.x, GreenSprite.y)-90)"

    Thank you so much, dop2000! Now it works.

    And for the distance point:

    How could I define a range of minimum and maximum distance between the different sprites at the time of being generated "randomly" (using that range)?

  • This is a bit tricky..

    You can generate the size of the next sprite in advance. Say, you're spawning sprite #1 (small), and at the same moment you randomly choose the size of sprite #2 (which will be created next) and save it in some variable.

    Let's say sprite #2 will also be small. Since you know that current sprite and next sprite are both small, you can use Timer behavior to schedule next spawn event in 1 second. If next sprites is big, you increase the delay and spawn it in 2 seconds. If both current and next sprites are big - in 3 seconds. This way the distance between sprites of different size will be roughly the same.

    This was just off the top of my head, there may be other solutions.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • This is a bit tricky..

    You can generate the size of the next sprite in advance. Say, you're spawning sprite #1 (small), and at the same moment you randomly choose the size of sprite #2 (which will be created next) and save it in some variable.

    Let's say sprite #2 will also be small. Since you know that current sprite and next sprite are both small, you can use Timer behavior to schedule next spawn event in 1 second. If next sprites is big, you increase the delay and spawn it in 2 seconds. If both current and next sprites are big - in 3 seconds. This way the distance between sprites of different size will be roughly the same.

    This was just off the top of my head, there may be other solutions.

    Mmmm, sounds interesting... Could you do me the favor of explaining it with some capture of Construct or something more visual? I’m a newbie and I’m not a programmer, so it’s a little bit difficult for me to understand some concepts. I would really appreciate it.

    Thank you, dop2000!

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