How do I set some random object not overlap each others

0 favourites
  • 4 posts
From the Asset Store
Hand-painted tiles, objects, animated objects, and background to build a colorful Mayan civilization environment.
  • 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.

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

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Yep, you'll have to create a loop that is repeating as long as at least one object is overlapping.

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

    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.

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