zoom/resolution problem

This forum is currently in read-only mode.
From the Asset Store
Adjusting the game screen for different resolutions (Letterbox scale)
  • hi

    I want to know if there is a way to zoom in on location other than center of the screen. To understand my problem try running say Platformer School tutorial files, or make simple scene where camera follows player controlled sprite on both Y and X. [preferably platform behavior]

    Now set this cap to 1280x1024 on fullscreen or smth like that and zoom it in, either layout or just plain zoom. if you zoom in enough what will happen is that your player character will be left offscreen.

    Even though camera is set to follow sprite, zooming in happens towards the center of the screen, so if player is at the bottom, and zoom happens at the center player will fall out of zoomed area.

    is there a way to zoom in directly on player? like offseting zoom or changing zooming in point or something?

    the way I was attempting to use it was on bigger resolutions I wanted to zoom in on screen so that in every resolution same amount of space would be visible at a time. I realized then that visual quality of game would be same as with just forcing smaller resolution in fullscreen, but there are other ways zooming in on player could be useful so...

    thx in advance!

  • the reason why this happens is because construct limits the scrolling to within your layout, so it will never show any pixels outside your layout

    unfortunately, it doesn't update these numbers as you zoom in.

    to fix this problem, first check "unbounded scrolling" in your layout properties

    this will allow it to show the outside of your layout

    this is still not what you want however, because you don't want your players seeing a void outside your layout everytime you get near the edge of your screen

    I made a cap with the math necessary to fix this

    scrollxLeft [/code:3bmets29]
    is an expression that tells you which pixel location of your layout is on the left of your screen, 
    
    so
    [code:3bmets29] ScrollXRight-ScrollXLeft[/code:3bmets29],
     would tell you how many pixels wide the zoomed in area of your screen is regardless of zooming  
    
    [code:3bmets29]((ScrollXRight-ScrollXLeft)/2)[/code:3bmets29]
    is one half zoomed in screen of pixels from the left of your layout
    which is where you would want the center of your screen if you wanted it as close to the left of your layout as possible when zoomed in, but not showing the outside of your layout
    
    [code:3bmets29]LayoutWidth-(ScrollXRight-ScrollXLeft/2)[/code:3bmets29]
    is the same thing, but on the right side of your layout
    
    ask questions if you still don't understand after looking through the cap
    I won't be on until tomorrow probably , but someone will probably be able to explain it a little better, and if not, when I log on, I'll try to clarify if you have questions
    
    [url]http://dl.getdropbox.com/u/1013446/scrollbounding.cap[/url]
    use the arrow keys to move the box
    mousewheel zooms in and out
    
    if you toggle those events off with the scrollx and scrolly, and just let it scroll to the green block
    you'll see how it would display the outside of the layout without those extra events as you got closer to the edge
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Awesome

    Thx man

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