How do I set some random object not overlap each others

Get help using Construct 2

Post » Thu Nov 10, 2016 8:59 am

So guys, i want to ask about this topic, so i have 6 objects and circle with 6 imagepoints. If i click the button, the objects will set position with random imagepoint (like multiple choice). but for now the objects sometimes just show up 3 or 5 objects(some object overlap with other object). Please someone help me.

Thanks before and sorry about my grammar and vocabularies.
B
20
S
7
Posts: 15
Reputation: 1,332

Post » Thu Nov 10, 2016 10:58 am

All you need to do is verify whether an object is overlapping another, and if so, set that object to a random position again. It'll change its position until it's no longer overlapping.
B
12
S
2
Posts: 15
Reputation: 735

Post » Thu Nov 10, 2016 3:14 pm

Yep, you'll have to create a loop that is repeating as long as at least one object is overlapping.
"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 » Fri Nov 11, 2016 2:18 am

gwerneck wrote:All you need to do is verify whether an object is overlapping another, and if so, set that object to a random position again. It'll change its position until it's no longer overlapping.

Ahh really thanks Gwerneck for your info, the problem already solve, so i use the method "random" with while and object is overlapping, but at the first click, the function will not run, but for second click and so on, the function work perfectly.

randomly wrote:Yep, you'll have to create a loop that is repeating as long as at least one object is overlapping.

Yeah thank you randomly, but i dont know, why the function not run at first click, but for second click and so on, the function work perfectly.
B
20
S
7
Posts: 15
Reputation: 1,332


Return to How do I....?

Who is online

Users browsing this forum: Yahoo [Bot] and 4 guests