How do I stretch all to fullscreen? (web).

Get help using Construct 2

Post » Tue Apr 14, 2015 10:46 am

I have layout In size 1366X768 and I have 1 sprite In size 1366X768.
Is it possible to stretch the layout and the sprite to fullscreen based on the user's browser size at runtime?

ndo = my sprite.

Image
B
8
S
1
Posts: 76
Reputation: 598

Post » Tue Apr 14, 2015 11:12 am

I usually work with ViewportLeft, ViewportRight, ViewportTop, ViewportBottom for these kind of things.

Easiest if the sprite has it's origin in the topleft-corner.

on start of layout
> sprite set width = viewportright(q) - viewportleft(q)
> sprite set height = viewportbottom(q) - viewporttop(q)
> sprite set position = x= ViewportLeft(q), y= Viewporttop(q)

if the sprite has it's origin in the center : x= Viewportleft(q)+0.5*(viewportright(q)-viewportleft(q)) , y= Viewporttop(q)+0.5*(viewportbottom(q)-viewporttop(q))

where q is the name or the number of the layer on which the sprite is
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Tue Apr 14, 2015 12:23 pm

Thank you. i do not know if I did it well, but in any case it did not work for me.

Image
B
8
S
1
Posts: 76
Reputation: 598

Post » Tue Apr 14, 2015 12:49 pm

When recreating it in my own project it does work, so could you explain what it is that isn't working and what effect you do get?

capx download
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Tue Apr 14, 2015 2:29 pm

Works Like Magic :-)
I had to change the "full screen in browser" to "scale outer"
B
8
S
1
Posts: 76
Reputation: 598

Post » Tue Apr 14, 2015 2:38 pm

I usually add a browser object, put these actions in a function and call the function both on start of layout and on browser resized.
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775


Return to How do I....?

Who is online

Users browsing this forum: blackhornet and 14 guests