How do I make retactable objects from inside a circle?

Get help using Construct 2

Post » Fri May 12, 2017 5:19 pm

I'm looking for a mechanic where that has a object retract in and out, similar to don't touch the spikes game, but inside of a circle instead of a square.

I'm looking for it to be a random set of objects to appear each time, but they can appear anwhere around the edges of a circle.

Can anyone help with this mechanic?
Image ImageImage
B
7
S
2
G
1
Posts: 91
Reputation: 1,239

Post » Fri May 12, 2017 6:45 pm

If I understand you correctly, what you need is a way to spawn objects randomly spread on a circle?

If so, this is what I would do:
  1. Set a number variable to random(360) to get a random angle
  2. Now, to the more complicated part: Getting the coordinates of the point on the circle using the angle we created before
  3. Get the X coordinate with this calculation:
    [X coordinate of circle center] + cos(angle) * [circleRadius]
  4. Get the Y coordinate with this calculation:
    [Y coordinate of circle center] - sin(angle) * [circleRadius][/b]

This should get you going.

Here is an example .capx, in case you are stuck.
"We can't solve problems by using the same kind of thinking we used when we created them."
- Albert Einstein
B
27
S
11
G
8
Posts: 528
Reputation: 7,091

Post » Sat May 13, 2017 4:47 pm

@randomly

Thanks for the reply, I'll check this out.
Image ImageImage
B
7
S
2
G
1
Posts: 91
Reputation: 1,239


Return to How do I....?

Who is online

Users browsing this forum: brunopalermo and 28 guests