WindowWidth & WindowHeight didn't work correctly

Get help using Construct 2

Post » Tue Jul 01, 2014 5:30 pm

Hi,

I'm making a card game, the problem is when i move a card to the bottom-right of the window game:

Card MoveTo (WindowWidth, WindowHeight)

this didn't work accurately:
https://drive.google.com/file/d/0B38Ir6KoVvgHdlBkVUlCNjF2dlE/edit?usp=sharing

However when i move it to 0,0 like that:
Card MoveTo (0, 0)
The card is well moved to the 0,0:

https://docs.google.com/file/d/0B38Ir6KoVvgHSVBNNEQwcmFESzg/edit?pli=1

:oops:

Can anyone explain how to solve this ?

Thx.

PS: I'm running with fullscreen LetterBox scale, margin set to 0,0 and the image point is set to the top-left of each cards.
B
11
S
3
Posts: 32
Reputation: 816

Post » Wed Jul 02, 2014 2:52 am

Fixed using LayoutWidth & LayouHeight or ViewPort.....
But still wonder why just WindowWidth & WindowHeight gives me a wrong Size?
B
11
S
3
Posts: 32
Reputation: 816

Post » Thu Jul 03, 2014 11:50 am

I had some problems with this at first, there are some more detailed answers on the forums. I always make sure that I get my own values whenever I need them, using layoutright(layer) - layoutleft(layer) or something similar.
B
25
S
5
G
3
Posts: 446
Reputation: 5,633

Post » Thu Jul 03, 2014 1:15 pm

@farflamex: Can you put some links regarding this subject?

Thanks in advance
B
11
S
3
Posts: 32
Reputation: 816

Post » Thu Jul 03, 2014 5:04 pm

Not sure I have any links, but where are you stuck? If you use layoutright(mylayer) - layoutleft(mylayer) you'll get the correct width of your window, unless you've done some other changes (not sure if it works if that layout is scaled/zoomed etc).
B
25
S
5
G
3
Posts: 446
Reputation: 5,633

Post » Thu Jul 03, 2014 5:25 pm

WindowWidth and WindowHeight give the pixel size of the view. With "fullscreen in browser" set to "off" the values will be identical to the viewport size.
B
92
S
32
G
110
Posts: 5,298
Reputation: 71,507

Post » Thu Jul 03, 2014 5:58 pm

@R0j0hound the point of having such variables is that they should work even with fullscreen ON...
Bruno

I like to eat, but I'm no cook. Why liking to play games would make you a game designer?
B
19
S
5
G
2
Posts: 546
Reputation: 3,259

Post » Thu Jul 03, 2014 8:45 pm

Must be reported as a bug ?
B
11
S
3
Posts: 32
Reputation: 816

Post » Thu Jul 03, 2014 10:00 pm

It's not a bug, when I was confused about it, Ashley set me straight. Now I just use the layout values to find the width and height, since it's always correct and up to date (perhaps not if you zoom, I don't know).
B
25
S
5
G
3
Posts: 446
Reputation: 5,633


Return to How do I....?

Who is online

Users browsing this forum: dand, mageekm, oosyrag and 20 guests