How do I evenly space Orbit objects?

0 favourites
  • 6 posts
From the Asset Store
Spaces Ambience contains 102 Sounds: 53 track and 49 sounds
  • So I am making the upgrades for a game of mine, and one is a sprite that orbits around the player similar to the Satellites from Magic Survival (or the Guardian from Survivor.io).

    The problem is, when the player has multiple spinners, I can't get them to evenly space around the player. As of right now the way the code works is that if the number of spheres is below what the player should have (since they can get more), it spawns another sphere and respaces all with a function (the function is so it doesn't keep the same instance selected)

    However, it doesn't work. Can someone help? (Event screenshot is below)

    spheres is a variable btw

    Tagged:

  • I'm not sure if loopindex works with For Each?

    Try using Repeat (or For) sphere.count times instead.

  • Wouldn't that just select all instances though? I'll still try it, I just don't know a huge amount about loops.

    Edit: Just tried it, didn't work.

  • Functions don't preserve picking, so you're selecting all spheres as it is right now anyway, which may be your problem.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Ok, I'll try that then. The reason I thought I couldn't pick just the one instance is because lets say the player had 2 spheres, then got a third. The first would be offset at 0, and the second at 180 (which would be correct)) but then getting a third and only moving that one would make it something like 240, and the others wouldn't move.

    But yeah, I'll see if that fixes it. If not, I could just have an id variable for each sphere and just check "If spheres = 2" & "id = 1" it would be handpicked with events.

  • Nevermind! It's fixed.

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