Anchor object hops to place

Get help using Construct 2

Post » Fri Mar 06, 2015 7:17 pm

My object thats using the anchor behaviour is kind of glitching to the right place on the start of the layout. It's on the lower part of the window and when I test it with a bigger resolution, it first is at the wrong place for the new resolution and quickly hops into place. Is it a way to make it not do this and just be there instantly??
Website Twitter Indie Developer
B
20
S
5
G
4
Posts: 203
Reputation: 2,888

Post » Sat Mar 07, 2015 1:23 am

Try to create an event like this (since I don't know the size of your object i'll suppose the object is a 100x100 button):

On start of layout ---> Set Button position to X:ViewportRight-60 Y:ViewportBottom-60

Don't forget to remove the Anchor behaviour
B
11
S
3
G
1
Posts: 91
Reputation: 997

Post » Sat Mar 07, 2015 11:57 am

Layout is 640x1136 and window is 640x960 (it's a iphone layout).
Object is 640x99 and 160x99 (4 buttons 160x99)
Website Twitter Indie Developer
B
20
S
5
G
4
Posts: 203
Reputation: 2,888

Post » Sat Mar 07, 2015 11:59 am

Also the viewport gives error: "'ViewportRight' does not take 0 parameters" :/
Website Twitter Indie Developer
B
20
S
5
G
4
Posts: 203
Reputation: 2,888

Post » Sat Mar 07, 2015 12:52 pm

Ooppps! You have to set the layers's viewport. So it is:

X:ViewportRight(2)-60
Y:ViewportBottom(2)-60

Assuming you have the button on layer 2 and you want to put it on bottom right side near to the corner of a layer with parallax 0,0 .
-60 is the distance from the screen edge.
Last edited by BouncyTrip on Sat Mar 07, 2015 2:20 pm, edited 2 times in total.
B
11
S
3
G
1
Posts: 91
Reputation: 997

Post » Sat Mar 07, 2015 12:59 pm

Also, i suggest you to follow this tutorial in case you'll need to support tablets or any other device: :)
https://www.scirra.com/tutorials/1126/m ... le-devices
B
11
S
3
G
1
Posts: 91
Reputation: 997

Post » Sat Mar 07, 2015 2:56 pm

Ah thanks! Will try it out now and see if it works better than anchors :)
Website Twitter Indie Developer
B
20
S
5
G
4
Posts: 203
Reputation: 2,888

Post » Sat Mar 07, 2015 3:00 pm

Yep! Thank you so much :D
Website Twitter Indie Developer
B
20
S
5
G
4
Posts: 203
Reputation: 2,888

Post » Mon Mar 09, 2015 6:44 pm

I'm glad to know it has worked! :D
B
11
S
3
G
1
Posts: 91
Reputation: 997


Return to How do I....?

Who is online

Users browsing this forum: Google [Bot], Husui, NextFriday, revengeracer and 17 guests