Window Width resize screen

Get help using Construct 2

Post » Sun Aug 03, 2014 4:42 pm

I can't get my head around this. I'm trying to make a book that will always have the spine in the middle of the screen. I've set the spine x pos to be windowwidth. But when I resize the browser window, it moves around the center. What am I doing wrong?

I've included some target resolutions in the background as guides.

https://dl.dropboxusercontent.com/u/10196246/Windowwidth.capx
B
19
S
3
G
2
Posts: 212
Reputation: 4,011

Post » Sun Aug 03, 2014 6:40 pm

You are mixing ViewPort & Window.

TextMain.X = (ViewportLeft(0)+ViewportRight(0))/4

Spine.X = (ViewportLeft(0)+ViewportRight(0))/2
ImageImageImage
B
71
S
21
G
231
Posts: 3,688
Reputation: 129,352

Post » Sun Aug 03, 2014 6:52 pm

That's a definite improvement. Thanks! However, when I match the browser to the ipad dimensions (blue background), the text is too far to the left and goes off screen. Why doesn't it go in to the middle of the left page?

https://dl.dropboxusercontent.com/u/10196246/Windowwidth.capx
B
19
S
3
G
2
Posts: 212
Reputation: 4,011

Post » Sun Aug 03, 2014 9:38 pm

I've been fighting with this myself. It's because of "Scale inner". The trick I'm using is to reference a sprite Anchored top-left.
You do not have the required permissions to view the files attached to this post.
ImageImageImage
B
71
S
21
G
231
Posts: 3,688
Reputation: 129,352

Post » Sun Aug 03, 2014 10:03 pm

:D You've forced me to think about this, and I've finally figured it out. You can't assume ViewPortLeft is zero.
You do not have the required permissions to view the files attached to this post.
ImageImageImage
B
71
S
21
G
231
Posts: 3,688
Reputation: 129,352

Post » Sun Aug 03, 2014 11:27 pm

Ahhhh! You rule! Thanks.

Edit: For future reference, this was the solution:

(ViewportLeft(0) + (ViewportLeft(0)+ViewportRight(0))/2)/2
B
19
S
3
G
2
Posts: 212
Reputation: 4,011


Return to How do I....?

Who is online

Users browsing this forum: Fradno, marcinkowski, tarek2 and 9 guests