center objects in fullscreen

Get help using Construct 2

Post » Fri Mar 23, 2012 6:06 pm

http://dl.dropbox.com/u/66278067/simple.capx

That's a very simple example (only 3kb)of my issue.

500x500 window, with an object placed at 250,250. I'm on a 16x9 ratio monitor, and in full screen (scaled) the object that should be at the center of the screen is way off to the left, even when I add the scroll to behavior.

I looked at the relevant tutorial, but the Anchor behavior doesn't work as I assumed it would. It says "relative to screen size" in the description of what it does, but I thought that meant that if the screen size increased, so would the distance between the object and the thing it's anchored to, but it doesn't seem to work like that, and it doesn't help for centering an object.

The next thing I tried was anchoring it to both top left and bottom right, as if both distances were kept relative, that would (I think) result in it being centered, but it just made the object have a fit (don't know how else to describe it).

Any help in working out what I'm doing wrong would be greatly appreciated.

Edit: I should also add that in the initial instance where I came across this problem, the layout is bigger than my screen, and I still experience the same issue. I can see why my small scale example might not make that clear, sorry for any confusion.

2nd Edit: I've just realized when I was trying with the larger layout, I hadn't removed the anchor before removing the scroll to. It now works. This means a workaround is to have an object in the center with scroll to, and anything else that needs to be positioned relative to the center of the screen can be pinned to that object.

I'd still like to know if there is a better solution.MonstaMunch2012-03-23 18:15:38
B
6
Posts: 22
Reputation: 751

Post » Fri Mar 23, 2012 8:10 pm

You need to set the layout's 'Unbounded scrolling' property to 'Yes'. Otherwise the scrolling will not be allowed to move outside the 500x500 layout area, which is required to be properly displayed when the window is larger than 500x500.
Scirra Founder
B
359
S
214
G
72
Posts: 22,946
Reputation: 178,478

Post » Sat Mar 24, 2012 2:57 am

Thanks Ashley, that makes sense and solved everything

Edit: Slight issue, and I'm just wondering if it's normal. I've found that by going fullscreen, the framerate drops by half to only 30fps, and at times even lower. If that is normal, what steps can I take to improve the framerate? I've tried "pixel rounding" as suggested in the manual and tutorials, but it didn't seem to improve anything.

I can send the capx if requested, but it's a bit big.

Edit: More info incase it's needed: I've tried both Chrome and Firefox, with the same result. Both rendered using webgl. I've also made sure that the project meets the suggested criteria in the Perfomance Tips section of the manual, with regards to maximum numbers of objects and particles.MonstaMunch2012-03-24 04:20:43
B
6
Posts: 22
Reputation: 751

Post » Sat Mar 24, 2012 3:04 pm

@MonstaMunch, what's your graphics card? Does the system expression 'renderer' return 'webgl'? (it's not enabled if not)

It may simply be that because there are more pixels on the screen when the screen is bigger, it takes more processing to render. Most computers can handle the extra size just fine but I guess some older computers or unsupported graphics cards might have trouble.
Scirra Founder
B
359
S
214
G
72
Posts: 22,946
Reputation: 178,478

Post » Sat Mar 24, 2012 5:00 pm

Yes, the "renderer" expression returns "webgl".

Through spending the day changing things a bit to minimize particle use, I've managed to get it up to around 40-50fps which seems ok, but still not ideal.

I'm running it on a Vaio with an Nvidia 310M. It's not fantastic, but I've found it can play most modern games at a reasonable framerate.

Chances are it's an issue with my events and conditions, or one of the changes I made when I discovered your link about delta time (I tried to get clever and just ended up messing things up). This is a project I've been working on since I discovered C2, and clearly I've made a lot of errors along the way. I'm just trying to clearly understand all the things I got wrong so I get them right on my next game :)
B
6
Posts: 22
Reputation: 751


Return to How do I....?

Who is online

Users browsing this forum: 99Instances2Go, jeffige, LeFuji, plinkie, Radulepy and 0 guests