[REQUEST] Layer scale width or height

Discussion and feedback on Construct 2

Post » Fri Apr 17, 2015 6:22 pm

Hi,

currently it's only possible to set a scale factor. But I want to scale a layer or layout along width or height. independently of each. I really miss this feature. It would be great if you would add this. @Ashley. It is an essential feature.

Application examples:
- Zoom into a piano roll.
- Faked isomatric map. Set Angle to 45 deg and shrink to 50% height.
...

sincerely
Dominik
B
13
S
4
G
1
Posts: 107
Reputation: 1,337

Post » Sat Apr 18, 2015 7:00 am

I think you could zoom into the piano roll by simply enlarging the image, having the sides outside the viewport.

The isometric fake your referring, seems like very bad practice (btw, its 57.7%)

I would go with simply rotating the sprites and re-sizing their height.
Even better, I would prep the sprites in my image editor, and import it as they need to appear, reducing the extra rendering required.

Also, would you scale only height or width of a layout, ALL objects would get affected.
Who dares wins
B
57
S
17
G
21
Posts: 1,878
Reputation: 19,572

Post » Sat Apr 18, 2015 1:16 pm

I still think It is an essential feature for a game engine. Regardless of my two examples
B
13
S
4
G
1
Posts: 107
Reputation: 1,337

Post » Sat May 02, 2015 8:16 am

And it seems you cant get the scale of a sprite, just from layout and layer for something like:

every 1 sec > set sprite scale to sprite scale - 0.1
Bl4ckSh33p-Soft - Custom Software and Indie Games
B
56
S
17
G
6
Posts: 748
Reputation: 9,420

Post » Sat May 02, 2015 5:10 pm

@Bl4ckSh33p , perhaps set the Sprite's scale to a variable and subtract from there?
composer - multimedia artist
www.eli0s.com/en/
B
69
S
27
G
6
Posts: 1,146
Reputation: 10,379

Post » Sat May 02, 2015 6:31 pm

Thanks for the hint. I used a variable as Workaround but it would be nice to have it just builtin to get the current scale. :)
But I switched back to "set size" after a few tries and just add +10 every tick until height=x
Bl4ckSh33p-Soft - Custom Software and Indie Games
B
56
S
17
G
6
Posts: 748
Reputation: 9,420

Post » Sat May 02, 2015 9:36 pm

@Bl4ckSh33p , I think that the set scale action is a bit hit or miss and can't really replace the functionality of the set width/height actions. Ashley had commented somewhere why is that, and why we shouldn't confuse the scale option with the actual size or what have you...

Best bet is to use the height/width actions.
composer - multimedia artist
www.eli0s.com/en/
B
69
S
27
G
6
Posts: 1,146
Reputation: 10,379

Post » Sat May 02, 2015 9:50 pm

It's a workaround.... You can obtain the object's scale on each axis, without using variables, by using the following technique:

(ScaleX is an object variable for its scale on the x axis...)

Object.ScaleX = Object.Width / Object.ImageWidth

There are similar object values to use for Y scale (ImageHeight etc).

So, if you want to set the Object.ScaleX to Object.ScaleX - 0.1 (or whatever you want = YourDeltaScaleValueHere) you could do the following:

Object.Width = clamp(Object.Width / Object.ImageWidth + YourDeltaScaleValueHere, 0.01, 100) * Object.ImageWidth

I would use clamp to ensure your sprite doesn't either disappear or invert.

NB, if you have stretched or changed the dimensions of your object in the editor then that will have altered the scale such that this might not work as you anticipate; in such a case I would create a Scale family and, On Scale Created, set Scale.StartWidth and Scale.StartHeight values to the Width and Height values (to equate to a scale of 1). Then substitute StartWidth in place of ImageWidth etc in the equation above.

I hope I have managed to explain this ok? It's hardly simple, but you could put it into a function and call it whenever you need to, having only to write it once.
A big fan of JavaScript.
B
76
S
20
G
73
Posts: 2,241
Reputation: 45,956


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 0 guests