How do I always scroll to middle of screen?

0 favourites
  • 10 posts
From the Asset Store
This Girls Game allows young fashionistas to develop their taste and skills as a fashion designer.
  • Hello World,

    So I'm trying, hard, to finally make my latest game actually work(in all aspects) with scale outer and, as you might have guessed, it's confusing as hell; all my other games I started by saying *Yeah, yeah, I'll make it scale outer* and I eventually gave up and used letterbox instead.

    So, one of the dozen problems I have at the moment is how do I make the game always scroll to the middle of the screen?

    I tried the following:

    on start of layout | scroll to position

    x: (ViewportRight(0) - ViewportLeft(0))/2

    y: (ViewportBottom(0) - ViewportTop(0))/2

    Doesn't work. I tried replacing the 0's with the name of an actual layer, doesn't work. I tried puting the viewports into variables and then doing (var.a - var.b)/2, didn't work.....

    I know I'm stupid, but what am I missing guys? How can I get my game to always center on the middle of the screen, regardless of what device it's playing on(resolution, aspect ratio, etc.)?

    Thank you.

  • First this question should be asked:

    What do you consider the middle of the screen?

    Fullscreen in browser Scale-outer should immediately center on the center of your original project-view..

  • Good question LittleStain . I consider the middle of the screen the middle of my layout size.

    So if I have a layout width of 640px(middle=320), but if the user has an otherworldly device with resolution of 30x30, then he should only be able to see from 305 till 335.

    Is it wrong to think about it like that?

  • Sounds like you don't want any scaling..

    (if that is the case, you should use fulscreen in browser : Crop )

    But anyway, I guess you'd want to scroll to 0.5*layoutwidth, 0.5*layoutheight

  • So what i was trying to achieve all this time is crop? Well, is it better with scaling LittleStain? And what's the difference, what would I need to do different in one as oposed to the other?

    Like I said, I'm very confused about this part, even after reading 3 tutorials....

  • Seriously LittleStain , I don't wanna have to use crop as that would show too little of the game on certain devices, and having enough space/time to maneuver is kinda important in my game. Plus I would have no idea where to put my HUD&stuff so they don't get cropped.

    I've read 3 tutorials and I still don't get it....

    Tut1

    Tut2

    Tut3

    Is there really nobody out there that can show me(and other noobs like me) once and for all how to clearly design games with scale outer? For both landscape and portrait situations, how big the safe zone is and where to put it, what window size and layout size to have(as you can see one tutorial says 640, 960, another one says 480 x 640), how to center the screen, how to scale the sprites(if they need scaling, and what size should they originally be created in), what if I want to have different "pages" on one layout like in this example, etc, etc, etc....

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I understand this:

    Seriously LittleStain , I don't wanna have to use crop as that would show too little of the game on certain devices

    But not after you said this:

    [quote:12rl791o]but if the user has an otherworldly device with resolution of 30x30, then he should only be able to see from 305 till 335

    After all, crop does exactly that..

  • The three tutorials you linked seem pretty good at explaining exactly what your question is about, what part of them confuses you?

    [quote:3jv2vsej]how big the safe zone is :

    The safe zone is exactly your original project size (While scaling outer your whole project will be scaled to fit inside the available space)

    [quote:3jv2vsej]what window size and layout size to have :

    Your choice completely..

    [quote:3jv2vsej]how to center the screen:

    scaling will automatically center to the original center of your project view if your layout is set to unbounded scrolling (which is the middle of the dotted rectangle), if you want to scrollto somewhere else use either the scrollto behaviour or the system scrollto action

    [quote:3jv2vsej] how to scale the sprites(if they need scaling, and what size should they originally be created in):

    The fullscreen option will scale yor sprites for you.. You'd probably want to create them the biggest size they will be shown, for bigger is unnescessary to make them look good..

    [quote:3jv2vsej]what if I want to have different "pages" on one layout like in this example:

    Like you said, you have an example already, it uses scale outer as far as I can see..

  • Here's a simple capx to show how scale-outer works:

    Scale Outer Example

    The blue rectangle is exactly the project window size..

    As you can see this is the save area..

    All four sprites in the corners are always on screen, no matter in what way you deform your view..

    (just change the size of your browser window to see the effect)

  • Well then I still must be doing something wrong/must not be getting something...

    I'll send you a PM LittleStain with some files, if you'd be willing to help me further.

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