Completely unexpected behaviour on resize

Get help using Construct 2

Post » Sat Apr 07, 2012 1:44 pm

- 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
Posts: 136
Reputation: 6,657

Post » Sat Apr 07, 2012 11:30 pm

@Whishy Thank you, you fixed my problem! I owe you!

But still, while your solution works, there is actually no need for my way not to, and I would love an explanation from @Ashley because there is a big discrepancy between the window size and the actual canvas size that c2 produces!
Basically, the only way to get the actual canvas size is to get the Width of the stretched sprite (as per Wishy method). But surprise! There is no safe way of doing it. Check this example:

On the start of layout the size of the Sprite is equal to the layout size. Then the first "pass" to a true condition it goes to 0x0 then it goes to the "magic" number that the canvas get.
In my real game, debugging the same way, it needs two passes to get to the "stable" value, the first 0x0 the second a number that rounded is almost the final value, the third the "stable" value.
Now I understand that the "stretching" is a behaviour that probably doesn't get initialized at the start of the layout but after a while (an unpredictable while by the way), why isn't there an event that tells us when everything is actually ready from the engine perspective?

Can you implement a way to retrieve the actual canvas size? Why isn't there an event in case the user resize the browser?

I hope this doesn't get ignored..
Posts: 525
Reputation: 8,329


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 3 guests