center objects in fullscreen

0 favourites
  • 6 posts
From the Asset Store
Welcome! I-Spy (Hidden objects) is an educational puzzle that is more than just seek-and-find activities.
  • 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.

  • 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.

  • Thanks Ashley, that makes sense and solved everything <img src="smileys/smiley32.gif" border="0" align="middle" />

    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.

  • 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.

  • 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 :)

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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.

    how can i have the game be centered on the screen in crop mode? because its always to the left so there white on the right of the game

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)