How do I move an object to a free space?

0 favourites
  • 3 posts
From the Asset Store
112 High-Quality destruction sounds for videogames
  • Hey there,

    In my game you can pick up items, and on top of the screen you will be shown what items you have collected so far.

    But I'm strugglin with making a system that checks if there already is an icon on top of the screen, so not all the icons are stacked on top of eachother.

    I made a quick comic to show what I want to achieve:

    All the items can be picked up in a different order, so the one picked up first will be put on the most right side of the screen, the second one picked up to the left of that one and so on.

    I tried multiple ways, including little boxes, with image frames according to the icon. But that didn't really work and seemed like a lot of work for such a small feature.

    What I have now is a little icon border that checks if the space if free or not, but I don't know how to tell to move to the next icon border when the space is not free, and to the next iconborder is that one isnt free aswell.

    I really hope there is an easier way

  • Can you create a variable for that, which will keep track how many objects are already there?

    Which will get +1 when you put something there and -1 when you remove it?

    And then when you add next object there you can position it with that variable, like (new object position.X = default position X - (variable * desired distance))

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • razorMonkey Thanks a lot! it works perfectly now.

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