Completely unexpected behaviour on resize

Get help using Construct 2

Post » Fri Apr 06, 2012 8:43 am

I'm stretching a sprite width do match WindowWidth, the resulting width is completely unpredictable and doesn't correspond with reality.

I included a capx(link) and a preview (URL).

Please help me, I don't understand this!
B
29
S
9
G
6
Posts: 525
Reputation: 8,294

Post » Fri Apr 06, 2012 9:11 am

[QUOTE=0plus1] I'm stretching a sprite width do match WindowWidth, the resulting width is completely unpredictable and doesn't correspond with reality.

I included a capx(link) and a preview (URL).

Please help me, I don't understand this![/QUOTE]

EDIT: The window size is always correct, is the resized object that do not make sense.
B
29
S
9
G
6
Posts: 525
Reputation: 8,294

Post » Fri Apr 06, 2012 10:15 am

I partly fixed this.

I understand that since the Scale Rate is 100% the width SHOULD be multiplied by two. If you change my capx setting W to WindowWidth/2 and now it almost works, but there is a percentage of error that changes based on the width of the medium and that I don't understand. Help @Ashley!
B
29
S
9
G
6
Posts: 525
Reputation: 8,294

Post » Fri Apr 06, 2012 7:56 pm

Bump? Please someone! I'm desperate..
B
29
S
9
G
6
Posts: 525
Reputation: 8,294

Post » Sat Apr 07, 2012 12:03 am

@Ashley, can you at least tell me the method that handles the scale mode resizing in the exported c2 unobfuscated code so that I can take a look at it?
B
29
S
9
G
6
Posts: 525
Reputation: 8,294

Post » Sat Apr 07, 2012 3:20 am

I'm afraid I'm not quite sure what you're trying to do. Do you want the sprite's width to match the browser's width while keeping the sprite's ratio? And is that regardless of the window aspect ratio and the scale mode zooming or not?

I'm not sure if it will help, but in scale mode, the zoom is dependent on the window height - you can resize the browser to see that the window width doesn't have anything to do with the zoom level.Arima2012-04-07 03:20:42
Moderator
B
88
S
32
G
33
Posts: 3,005
Reputation: 27,432

Post » Sat Apr 07, 2012 9:32 am

@Arima thanks for trying.
Basically I'm trying to find a way to STRETCH (withouth mantaining proportions) the background of my app, so that even if the aspect ratio is not 1.5 (iPhone) the background covers the whole screen. The element are then repositioned while mantaining their aspect ratio, only the background sprite will become "deformed".

To do this, after checking the aspect ratio, I change the width of the background to WindowWidth/2, this is because since the canvas is scaled by 100% it SHOULD double.
In reality there is a discrepancy between the canvas that c2 creates and the real WindoWidth, probably this is a bug or I am simply ignorant.

Open my capx if you can, I added an event.. click on the rightmost pixel of the screen and you'll see that there is a discrepancy.
EG:

640x1366(res) aspect ratio 0.47..
Rightmost Pixel-> Mouse.X = 1019, Absolute 1365 (which is the window-1)


Another EG:

596x570(res) ratio 1.04..
Rightmost Pixel-> Mouse.X = 458.4, Absolute 569

This changes as the aspect ratio changes, going from a few pixels to huge gaps.

If I can get the REAL canvas size of C2 I would've fixed my problems, because I would set the W varible to the real width that C2 is using.
I need it to be precise to reposition object (for example sprite set X = (Width-3)-(self.Width))
B
29
S
9
G
6
Posts: 525
Reputation: 8,294

Post » Sat Apr 07, 2012 12:20 pm

u mean something like this background ?

http://ohrly.net/boingbeta/

I'm not sure if I understand what you mean, but I just set the size of the background to the size of the window...
B
22
S
11
G
9
Posts: 133
Reputation: 6,572

Post » Sat Apr 07, 2012 1:27 pm

@Wishy yes! It is! How do you do it? Scale mode? No Fullscreen? Parallax.. can you fix my capx to make it work so I can see how you are doing it?
B
29
S
9
G
6
Posts: 525
Reputation: 8,294

Post » Sat Apr 07, 2012 1:44 pm

http://dl.dropbox.com/u/65731657/bgresize.capx


- Assign the BG pic's Origin Top-Left (so 0,0 is upper left)
- Add Anchor behaviour (left to left, top to top, right to right, bottom to bottom)


i think you were searching too far :)
Wishy2012-04-07 13:46:02
B
22
S
11
G
9
Posts: 133
Reputation: 6,572

Next

Return to How do I....?

Who is online

Users browsing this forum: makkancs and 23 guests