Automatically Layout-Resize

This forum is currently in read-only mode.
From the Asset Store
Simple resize and rotate events for any sprite, quick and easy event sheet that you can use for your own projects.
  • I take a Layout with a size of 1024x768 and want to let the user resize it to 1280x1024 and above. Can I do this via the "System:Set Layout size to" and/or "System:Change Display size to"-Events without the need to reposition every sprite to it's X/Y-value?

    Elsewhere you always have a very long Event-List to position the sprites:

    e.g. for a fullsize background image it will result in four lines of code for one object!

    Sprite: Set width to 1280
    Sprite: Set height to 1024
    Sprite: Set X to 640 (Width/2)
    Sprite: Set X to 512 (Height/2)
    [/code:xygy28os]
    
    Or is there an other solution for this problem 
    
    I hoped that the "System:Change Display size to"-Event would do the resize, but it doesn't.
  • In my opinion, you should take advantage of layer zooms. Build your game around a certain resolution and aspect, and then zoom your layouts using that as a base.

    In pseudo code:

    OriginalX == 640
    OriginalY == 480
    CurrentX == ?
    CurrentY == ?
    Set X Zoom factor to:
       (CurrentX * 100) / OriginalX
    Set Y Zoom factor to:
       (CurrentY * 100) / OriginalY[/code:179ejxv1]
    
    This is a simple ratio thing I learned in high school.  It produces a percentage of scale (with OriginalXY being 100%) that will always correctly scale your layers to any resolution in the same aspect ratio.
    
    EDIT:  I should point out if you plan on letting your game scale to high resolutions, you should create all your graphics at as high a resolution as possible and scale them down in Construct.  Thus, when you zoom your layers you do not encounter blurry sprites and backgrounds.
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • In any resizable game I've developed, I've always just positioned everything relative to the window, ie. using the expressions ScrollXLeft, ScrollXRight, ScrollYTop, ScrollYBottom (and DisplayWidth, DisplayHeight). This way, no matter what you resize the window to, the objects automatically position themselves relative to the window.

  • Relative-to-the-window is great, but it doesn't solve everything. If you wanted to scale your game to 1080p, for instance, proportional zooming is a better choice as it avoids making your graphics too small to see.

  • Relative-to-the-window is great, but it doesn't solve everything. If you wanted to scale your game to 1080p, for instance, proportional zooming is a better choice as it avoids making your graphics too small to see.

    Zoom is a good thing to work with if you use it for 3D, but how would you zoom the layout if you just use it for the GUI and you didn't want to let the user scroll the GUI-Window or have large buttons?

    In any resizable game I've developed, I've always just positioned everything relative to the window, ie. using the expressions ScrollXLeft, ScrollXRight, ScrollYTop, ScrollYBottom (and DisplayWidth, DisplayHeight). This way, no matter what you resize the window to, the objects automatically position themselves relative to the window.

    Yepp, that's what I've mentioned above! Positioning the sprites relative to the original position! I've just wanted to know if there is an automatic function for it in Construct (like auto-positioning)?

    bugreport:

    Function:
    SystemSet Layer 1 zoom offset to (1, 0.0)
    [/code:x8ei0cxv]
    
    This function kill the Debug-Window with an unhandeld error!
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)