How do I drag items in the UI and keep sprites position rel.

0 favourites
  • 6 posts
From the Asset Store
Use inertion of your movements to throw, rotate your objects and etc. Objects can interact with others while dragging.g
  • So I have a game where there is a slider in the User Interface. When at the start of the game in the top left corner, the slider works beautifully well, however as soon as I leave that corner, the slider moves down. I need it to stay so that for example, if it is on value 5, it will stay in the same position when I move. The slider only updates the fact that it is off-value when I click it and the slider appears further down than where the mouse it. The X cords are fixed anyway, but the Y cords are set within a perametre of min/max so it just sits at the bottom.

    Anchoring doesn't seem to help. When I anchor and try to move it, the slider pings to the bottom.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Anyone?

  • Hi can you please share a capx, that way I can test it out and try to find a solution for you.

  • After looking at the capx, I know what the issue is. You are setting the slider.y to touch.y. But they are on different parallaxes. The slider is on 0 parallax, but the touch works on the entire layout which is using 100 parallax. That is why when your sub goes down, your slider wants to go down too, because touch.y is actually much lower than the limit you imposed on it, but because of the limit, it won't go lower than the slidermarker.

    Fortunately, the solution is easy enough. All you have to do is instead of "set Y to Touch.Y", set it to "set Y to Touch.Y ("UI")" This will tell C2 that you want the touch value that is based on the UI layout.

  • That works amazingly! I'll be sure to remember that. Thank you so much!

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