How do I scale non-uniformly a layer?

Just started using Construct 2? Post your questions here

Post » Wed Aug 19, 2015 10:46 pm

Hi,
How can I resize a layer without constrain proportions?

Like this:
Image

It's very easy to do this on Scirra Construct Classic (New action -> System -> Set Zoom -- and then adjust X and Y independently) but I have no idea on how it can be done on Construct 2. I've found out only how to proportionally scale a layer on C2 (New action -> System -> Set layer scale).

Thanks in advance! =D
B
20
S
6
G
1
Posts: 59
Reputation: 1,878

Post » Thu Aug 20, 2015 11:38 pm

I take it you would like to fill the viewport with an image? If yes, how about setting the image dimensions === to the Layout dimensions... What do you reckon??
web worker
B
18
S
3
Posts: 7
Reputation: 1,528

Post » Fri Aug 21, 2015 1:20 am

ij3m wrote:I take it you would like to fill the viewport with an image? If yes, how about setting the image dimensions === to the Layout dimensions... What do you reckon??

Thanks for your reply - but I guess it won't work. :(
I need to resize an entire layout (all graphics there) to a specific aspect ratio.

I'm making a game that simulates an old 8-bit Nintendo game.
NES games were designed in a 8:7 aspect ratio - however they were played in a wider, 4:3 aspect ratio.

Super Mario 3 was designed this way:
Image

But in a television the image looks different. Something like this:
Image

I've designed "Tcheco" (quot-tcheco-quot-my-cc-video-game_t103890) exactly like this (in a 8:7 aspect that changes to 4:3 when played). Now I want to convert "Tcheco" to C2 - but it would be horrendous if the game runs in the wrong aspect ratio. :(
Any help is welcome! Thanks!
B
20
S
6
G
1
Posts: 59
Reputation: 1,878

Post » Fri Aug 21, 2015 6:03 am

I perfectly get how you mean, I do not have expert knowledge but see if this helps- https://www.scirra.com/tutorials/73/sup ... zes/page-2.

Also the 4:3 aspect ratio scales to 8:6 as in [2(4:3)] and which is != 8:7 hence it will not be a perfect fit. I will like to see how this is resolved so I will appreciate it if you find a working solution post it on here still. Good luck!
web worker
B
18
S
3
Posts: 7
Reputation: 1,528

Post » Fri Aug 21, 2015 6:52 am

You might be able to overwrite the width/height of the canvas that is used when drawing the game to adjust it to the desired proportions (you'd use javascript to do so).. I'm not sure if it would have any side-effects though.

edit: I think you'd modify the css width/height.
B
47
S
22
G
65
Posts: 1,127
Reputation: 38,395

Post » Fri Aug 21, 2015 8:00 am

I am not sure it would work but perhaps pasting the layers with the canvas plugin, loading the result in a sprite, and setting it's size on both axis could work, however It could be really slow.

Also keep in mind that 8:7 to 4:3 can work (as it is a slight change of aspect ratio), but 8:7 to 16:9 will not be pleasant for anyone involved (Manos is an exemple of a game that scales completely like that, and... it is disturbing), and as 16:9 screen are now something common, it is something to think about.
Game design is all about decomposing the core of your game so it becomes simple instructions.
B
53
S
22
G
18
Posts: 2,122
Reputation: 17,123

Post » Fri Aug 21, 2015 2:48 pm

Thank you very much for all replies!

- ij3m, this tutorial is very good, but I couldn't find anything about resizing an entire layer or layout there.

- Thanks for the tip, Prominent - but any javascript solution seems to be way too advanced for my skills.
I wish there was a simple action or plugin to resize "X" and "Y" of my layers independently.

- Aphrodite, your idea (to use Canvas plugin) was pretty good - but I couldn't make it work. When I paste a layer on canvas it simply doesn't appear (I don't know what I'm doing wrong since other actions like "paste object" or "draw square" are working).

And yes, my plan is to make an 8:7 to 4:3 conversion (since my game tries to look like an 8-bit NES title).
I'm aware it would look ugly in 16:9.

My game ("Tcheco") was made in Construct Classic since I had no money to buy a C2 license.
I could change the aspect ratio just like I wanted:
Image

Now I have a C2 license and would love to convert it from Construct Classic to Construct 2. All I get is this:
Image

I'ts very frustrating not being able to resize my layouts. If it's not really possible I won't even bother to convert the game (keeping the correct aspect ratio and being faithful to NES aesthetics is very important to me).
Thanks again for your help and any new ideia is welcome! :)
B
20
S
6
G
1
Posts: 59
Reputation: 1,878

Post » Fri Aug 21, 2015 4:51 pm

It might take a bit of work, but you could maybe use families to help reduce the amount of events:
You could set up a function that checks the position of an object in relation to the entire screen width/height.
Get the distance via a percentage of the width and height..
So if the object has x position of 25 and y position of 10, and the screen at original scale is 100 x 100..
25/100 is 0.25
10/100 is 0.10
Then you take the stretched scale.. say the screen should be 130x110..
the object's new position would be 0.25x130 for the x axis, and 0.10x110 for the y axis.
You'd then have to adjust the object's height and width by doing the same calculations.
130/100 is 1.3 , so the size increase by 1.3 times.
the object's new width should be 1.3 times bigger. 16x1.3 is 20.8 for the new width
Do similarly for the height..
Do this for every object in the game that needs resizing/repositioned..
B
47
S
22
G
65
Posts: 1,127
Reputation: 38,395

Post » Fri Aug 21, 2015 9:05 pm

Thanks Prominent! Your solution looks way too advanced for me but I'll see if I can make it work.
Meanwhile I'll wait for an update/plugin/effect that freely resizes layers or layouts.
Thanks again for all the help!
B
20
S
6
G
1
Posts: 59
Reputation: 1,878

Post » Tue Aug 25, 2015 10:53 pm

@macbee

I'm kinda confused as to what you want exactly but maybe you're looking for the "letterbox scale" option in the project properties? It's under "fullscreen in browser".

https://dl.dropboxusercontent.com/u/238 ... ratio.capx

example of how it looks: http://i.imgur.com/Fu5eTkG.png
B
125
S
43
G
41
Posts: 849
Reputation: 28,260

Next

Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 1 guest