Auto resize a background (not tiled)

0 favourites
  • 6 posts
From the Asset Store
Each tile 64 by 64 pixels - Ultimate Tile Set for your awesome games
  • Hello, I'm new on the forum and a recent french user of construct 2.

    I'm trying to create an application supporting multiple screen sizes with a 1920*1080 background (which is not tilable). To do so I use the scale mode of construct 2. This mode works perfectly but if the window does not have the right ratio (width/height), we can see a blank rectangle on the left or at the bottom (it depends on the ratio) of the browser window.

    So y tried to resolve that by resizing the background in order to adapt it to the window in the best way (with a screen ratio based calculation on every tick). It's better but not enough.

    If someone has an idea about how to do that or to correct what I made, I am listening. <img src="smileys/smiley17.gif" border="0" align="middle">

    Here is the capx file :

    capx file

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • It's best just to draw backgrounds wider than the window size, then the normal view will just be cropped. Then if scaling up to a bigger window size the previously invisible bits become visible.

  • If you use On start of layout > Set (bg)Size to (WindowWidth, WindowHeight)

    the background will use the window's size dimensions.

    It will stretch the window in some cases, but the ratio's aren't that massive of a difference so you could resize your background to fit both ratio's.

  • If you use On start of layout > Set (bg)Size to (WindowWidth, WindowHeight)

    the background will use the window's size dimensions.

    It will stretch the window in some cases, but the ratio's aren't that massive of a difference so you could resize your background to fit both ratio's.that should work but keep in mind that the img need fo have a nice resolution to dont lose too much quality while streching..

  • Thanks for all your answsers. Your proposition was interesting but not solves the problem during window resizing.

    In fact, I found the solution. I just set the "unbounded scrolling" to yes and the margins to 0. And it works nice ! My calculation was right. You can test it with capx file I joined in the first post (just do the modifications in the project properties)

    Thanks again.

    I hope that will help.

  • You figured it out on your own. I was just going to point you to this nice example by gammabeam:

    Multiple Resolutions - Solid example

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