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

Get help using Construct 2

Post » Sat Jan 16, 2016 11:27 am

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.

Image

Image
- Head of Tall Story Studios.

Creator of GOV, Project Abyss, Spiritlands & more!
B
27
S
12
G
1
Posts: 124
Reputation: 3,044

Post » Sat Jan 16, 2016 6:23 pm

Anyone?
- Head of Tall Story Studios.

Creator of GOV, Project Abyss, Spiritlands & more!
B
27
S
12
G
1
Posts: 124
Reputation: 3,044

Post » Sun Jan 17, 2016 10:30 am

Hi can you please share a capx, that way I can test it out and try to find a solution for you.
B
39
S
18
G
30
Posts: 680
Reputation: 19,431

Post » Sun Jan 17, 2016 10:58 am

- Head of Tall Story Studios.

Creator of GOV, Project Abyss, Spiritlands & more!
B
27
S
12
G
1
Posts: 124
Reputation: 3,044

Post » Sun Jan 17, 2016 12:52 pm

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.
B
39
S
18
G
30
Posts: 680
Reputation: 19,431

Post » Sun Jan 17, 2016 5:32 pm

That works amazingly! I'll be sure to remember that. Thank you so much!
- Head of Tall Story Studios.

Creator of GOV, Project Abyss, Spiritlands & more!
B
27
S
12
G
1
Posts: 124
Reputation: 3,044


Return to How do I....?

Who is online

Users browsing this forum: pokka and 3 guests