Stetchihng image size to windows size

I’ve already made the window size change by the screen size[spoiler]No conditions: Change window size: ScreenWidth()xScreenHeight()[/spoiler]. But i still dont find way to stetch the given image to the window size and keeping the image ratio…someone help…thanks

You can do this with the scale function under the sprite tab. Scale 1 is the original image size, so you can’t just set it to the window size, you’ll have to do some math stuff to get the desired scale. If the aspect ratio of the window is different than the one of the image you won’t get around stretching the image or having some parts of it go beyond the screen or having some parts of the screen not being covered by the image.

I’ve replied on a duplicate, so I copy my message here and delete the duplicate :slight_smile:

*Moved :slight_smile:

What do you want to do exactly?, because there are three ways to get a full screen:
A - Set the window size = screen size, if the window ratio is different than the screen ratio, the graphics will be stretched.
B - Set the window size = screen size, but adding black/white borders (modifying the camera size) to keep the original graphics ratio.
C - It’s the same as B, but instead adding black borders, make the camera to see different scene zones, for example somebody with a wider monitor will be able to see further horizontally.

Personally, I would try the following:

  • First check if the screen ratio is the same, wider or higher than the original game size.
  • If they are different modify the camera size to see different game zones, until it gives dis/advantage (for example until the monitor is so wider that the player can easily avoid future obstacles).
  • Then, if I can’t increase more the camera size (because dis/advantages), add black borders or stretch (player option :wink: ).
1 Like

Thanks for the fast replies
sleeper_service i did this already but for some reason the image just disapears so im trying other ways…maybe its a bug

Lizard-13 i think im at C but i dont understand what do you mean from the 2nd * you wrote…and btw the game is without player

*EDIT: I done it ive made stupid mistake thanks for the replies anyway :smiley:

Ignore - I found the answer, but can’t delete the message.

ook so the same problem apeared again somehow the other stopped working…help

I have no idea what you are trying to do… What is it exactly? :confused:

I already done WindowSize to be equal to ScreenWidth()xScreenHeight()
[spoiler]No conditions | Change window size: ScreenWidth()xScreenHeight()[/spoiler]
That means the window will change its size by the Screen size. For example if the ScreenSize is 800x600 the WindowSize will be 800x600 (WindowSize=ScreenSize).
Now i want to make object keep its size ratio no matter how different are the X and Y Scales of the Screen. Right now if i add only the ScreenSize event the object will change its size depending on the screen size which is understandable but i want the object to keeps its size ratio (for example no matter how big are the values of the screen size i want the object to keep 50x50 size) and after i do this i want to make the object change its ratio depending on the screen size…
Just like Android game… Imagine you are using different display size than your friend, but the game should resize to it no just fits in his display and (if yours is bigger) you to see gray outline around the game…
And now, imagine you play on PC but your display size is 1366x768 and your friend’s display size is 1280 x 1024. We already have the screen resizing…which means the screen will fit in both displays but…the object in the game is with size 50x50…the program automatically changes the object size according to the screen size (which size is according to the window size so we accept screen size = window size) that means the object cannot keep its size keeping same on both dispays if the game is made with scene size = 1366x768 and the object there is 50x50 it will be nice displayed on your display but on your friend’s display it will be resized cause the size of the game isnt the same…the object will be with bigger height than width…
i really hope you understand this long thing if u dont tell me ill try more simple this time…

I colored those words just cause…i can (joke its to be easier to understand follow them)

Here is an example: (13.1 KB)
(Press 1, 2 and 3 to switch between different ratios: original, wider and higher respectively. I guess you know you have to compile the project to try it).

There are two different methods, deactivate one event group and activate the other to try them out:

  • The first one modifies the camera render zone, it keeps the aspect ratio adding borders with the color of the scene background. Note that this one “truncate” the view, you can’t see the blocks outside the camera view.
  • The second one modifies the camera size, the camera gets wider/higher with the window, this way it also keeps the original ratio. The difference is that in this one you can see further, for example in the wider ratio you can see blocks at the sides, outside the original view, and this is what I mean with dis/advantages, what would happen if somebody has advantage because he can see those blocks before?

EDIT: I took the liberty to change your post colors to others more saturated, I think they looks better/more friendly, and don’t hurt your mind :imp:

or my pc is broken or that is equal to this:
actually if i delete all events it does the same :confused:

i need the game to resize to the window size…
also idc about the color change i just used them to help the ppl understand…

To what?

In my example?.. is your game native?, if it’s HTML5 there are no camera render zone / camera size actions, you can just use the action “Activate fullscreen: yes” with the option “keep aspect ratio: yes” :slight_smile:

Thanks you so much for this reply i done it cause of it! thanks

but now i ave a question…i made it for both platforms i see there says HTML5 and Android…does that means the game is playable on any phone??? like android and iphone