Random Position problems

0 favourites
  • 4 posts
From the Asset Store
Easily generate many levels from a set of pre-built scenes (Construct 3 template)
  • I need to randomize the starting position of 10 objects in 10 specific locations, so far I got, however when it randomizes the objects in places, it overlaps some elements

    I need a solution to where to start, they are in different positions, and not overlap each other.

    remembering, random works, only that sometimes, an element overlap each other

    can someone help me?

    tks (:

    and I'm sorry if it is not the right place for this question, I'm new here

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I'm completely new to here, so my answer may be completely non-sense, but, try checking if the object you just placed is in collision/overlapping other objects, if so reposition it again, not the best way to do it, but might work I guess

  • You could go the complex route and have an array that stores previous positions, to test whether the one you are placing has something in its place already, or simply throw in a collision/overlapping test, and redo the random again if it tests positive.

  • I like I could do to when collision / overlapping, redo the random?

    in my event sheet: (I can not post images yet D:)

    • On start of layout: destroys the object to be randomized
    • then create object positioned in "slot.x" - "slot.y"
    • and do other procedures to leave his position on the random slot

    ("slot" are 10 objects I created, which will be organized on the screen, and other objects, will be randomized on him, remembering that I want each object on top of a slot, none on the other)

    tks

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