Moveable User interface - snapping issues

Get help using Construct 2

Post » Wed Feb 17, 2016 2:47 am

Message: Landermere can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
Hello there fellow nerds!
I am currently creating a Moveable user interface that allows the player to...well....move the interface.

I have currently got to a state where I have pinned events onto the frame and have a lock mechanism that enabled/disables the frame from being moved.
This frame can be dragged (if unlocked) anywhere on the screen however, when I move the playable character outside of the standard window size area (854, 480), The user interface moves as if paralexed incorrectly and snaps to the extreme side of the screen, however this is not the case as the layer has a 0, 0 paralex.

Below is a screenshot for the events I have just to show you I am not crazy hehe.

http://pasteboard.co/1BWOpfJm.png

Another point to add is that I have only been able to use the left/right viewport along with original windowheight as the other options were not valid.
Thanks in advance to anyone that is willing to lend a hand on this matter!
I look forward to receiving help :)
Stay awesome.
Chris
B
8
S
1
Posts: 46
Reputation: 544

Post » Wed Feb 17, 2016 3:31 pm

It is a bit unclear exactly what you are trying to do here. I mean obviously you want movable UI pieces, but they snap to... what exactly?
https://www.ravenheart.ca/home
Company name changed to avoid Facebook-type shenanigans

"Someone once told me I bite off more than I can chew...

I told them I would rather choke on greatness than nibble on mediocrity."
B
22
S
6
G
1
Posts: 1,365
Reputation: 4,724

Post » Wed Feb 17, 2016 4:02 pm

I see :)
All of the User interface events are set on their own layer above the game layer, it has a 0, 0 parallax setting.
The UI events should not be moved beyond the boundaries of the screen.
In order to define the "boundaries of the screen" I have to compare the events in the screenshot above.
Once the player has moved the User Interface events outside of the "boundaries of the screen", the user interface does successfully snap to the "boundaries of the screen". This only works while within the default window size and when this is no longer true the user interface events snap to the left/right side of the screen or moves as if paralaxed.

The goal is simple. create a user interface that can be dragged within the boundries of the screen,
once released from the dragdrop behaviours, it will stay there regardless of where the player is within the level.
I'm not really sure what else I can convey :/
Thanks for respondingGumshoe2029 :)
B
8
S
1
Posts: 46
Reputation: 544

Post » Wed Feb 17, 2016 9:25 pm

What you might try doing is putting a thin sprite on each side of the screen just outside of the screen area, then just assign "Solid" to all of the boundaries, and 8-direction to all of the UI pieces.
https://www.ravenheart.ca/home
Company name changed to avoid Facebook-type shenanigans

"Someone once told me I bite off more than I can chew...

I told them I would rather choke on greatness than nibble on mediocrity."
B
22
S
6
G
1
Posts: 1,365
Reputation: 4,724

Post » Wed Feb 17, 2016 9:33 pm

You should use ViewPortLeft/Right/Bottom/Top and specify for which layer you want the coordinates. ViewPortRight(0) gives you the y coordinates of the visible right edge of layer 0. If layer 0 is not your UI layer, it will not work correctly. Also, since you are using a System Condition and not actual "Frames" conditions, I recommend you add "For each Frames" and put all 4 events under it, otherwise, unwanted behavior will most likely occur.
B
62
S
26
G
24
Posts: 954
Reputation: 18,318

Post » Thu Feb 18, 2016 2:36 pm

Thanks for the replies guys/gals
@gum I want to optimise the performance of the game so while that method is easily implemented and pretty much guaranteed to work, I don't think it would be optimal to have the event there. I want to have 1 box of code that does all of the work rather then having unnecessary events that will slow down the game.

@magi the viewports only work for the viewport right and left for some reason =/
B
8
S
1
Posts: 46
Reputation: 544

Post » Thu Feb 18, 2016 2:40 pm

Message: Landermere can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
well I never...
I was playing around with the program and ended up fixing it.
here's a link to the completed program :)

http://pasteboard.co/1EdPQKgo.png

I might put together a tutorial for this at some point too hehe
Thanks for your assistance guy/gals! <3
B
8
S
1
Posts: 46
Reputation: 544

Post » Sat Feb 20, 2016 3:59 pm

That is usually how it works. My quote for this stuff is always: "Fiddle with it until it works or you break it."
https://www.ravenheart.ca/home
Company name changed to avoid Facebook-type shenanigans

"Someone once told me I bite off more than I can chew...

I told them I would rather choke on greatness than nibble on mediocrity."
B
22
S
6
G
1
Posts: 1,365
Reputation: 4,724


Return to How do I....?

Who is online

Users browsing this forum: FabianB and 12 guests