How do I move this object the first time?

Get help using Construct 2

Post » Thu Dec 04, 2014 10:30 pm

I'm trying to create some UI elements for my game. A scroll box is going to be important for navigating an arbitrary long list of objects. So I have the scrollbox built and sitting outside of the layout and all of the objects (except the scrollbar) is pinned to one item and I move that item. So when I click the button I have an event that moves the main window and the scrollbar (in that order) into the window but for some reason the scrollbar isn't put into the correct position. If I click the button a second time, then the scrollbar gets moved.

Can someone explain to me what's going on and how to make it behave as expected?

Secondary questions: Why are there lines on my 9-patch windows and orange scrollbar? If I change the mode to exact these lines become even more prominent. The larger gray bar is not translucent and does not seem to have that line.

Why does the button play the press animation on loadout start? Initial animation is set to "None" and the only animation in the animation list is "Press".
You do not have the required permissions to view the files attached to this post.
B
10
S
2
G
2
Posts: 73
Reputation: 1,044

Post » Thu Dec 04, 2014 11:29 pm

I can't see the object names in your events but it looks like you have the ScrollBack sprite pinned to the MenuWindow. When you click the button you move the MenuWindow to 120,120 but things pinned to it won't have their position updated until after the whole event sheet runs. You're setting the scrollbar to ScrollBack.X before ScrollBack moves.

Initial animation is set to "None" and the only animation in the animation list is "Press".

If you don't have an animation called "None" then it's going to play the first animation that you do have. If you don't want the animation to play you can set it's speed to 0 in the animation properties or you can stop the animation on start of layout.
B
55
S
29
G
19
Posts: 1,520
Reputation: 25,670

Post » Fri Dec 05, 2014 12:28 am

I tried using a pin event to pin the scrollbar at start to the window so it gets moved like everything else and unpin in the same event but the behavior is the same. I also tried creating a subevent thinking that maybe the primary event needs to finish executing first but still no luck.

I ended up settling on just forcing it to the X value of the scrollbarback every tick. I suppose I'll need to figure out how to move it to the top every time the window is summoned.
B
10
S
2
G
2
Posts: 73
Reputation: 1,044


Return to How do I....?

Who is online

Users browsing this forum: brunopalermo and 23 guests