Why isn't Scale an expression

Discussion and feedback on Construct 2

Post » Sun Aug 03, 2014 5:23 pm

I would like to use Self.Scale, but it's not an option. I can get around it using other more complicated methods, but Self.Scale would be so much easier.

Is there a particular reason this isn't permitted?
@bearboxmedia
www.bearboxmedia.com

Nintendo Wii U Developer using Construct 2
B
84
S
15
G
7
Posts: 991
Reputation: 11,231

Post » Sun Aug 03, 2014 5:24 pm

This was explained maybe less than two months ago in another thread.
B
35
S
9
G
3
Posts: 493
Reputation: 4,092

Post » Sun Aug 03, 2014 5:26 pm

alvarop wrote:This was explained maybe less than two months ago in another thread.


That's not a valid reason why it isn't there. "the main problem was what value should be returned if the object was not uniformly resized".

What about those of us that DO have uniform size?
@bearboxmedia
www.bearboxmedia.com

Nintendo Wii U Developer using Construct 2
B
84
S
15
G
7
Posts: 991
Reputation: 11,231

Post » Sun Aug 03, 2014 5:44 pm

I think it's a no-brainer: return -1 if the scaling is not symmetrical, otherwise return the object's scale.
A big fan of JavaScript.
B
76
S
20
G
76
Posts: 2,285
Reputation: 47,554

Post » Sun Aug 03, 2014 6:04 pm

Basically you would have to add a bunch more values to store for each instance. You can't store the scale for just one dimension, even if they were the same, because of the uniform thing.
It would have to have the scale for the width, and the height, and probably if it scales the default, or the original size, again because of the uniform thing.
An instance variable works well for this tho.....
Image ImageImage
B
172
S
50
G
183
Posts: 8,442
Reputation: 115,603

Post » Mon Aug 04, 2014 3:21 am

yep. you can't just have a singular scale value.

How Unity handles scale and it's fine here. Scale is the %0.0-1.0 value and has scale for X/Y and Z of such. The scale assumes the original image dimensions. I'm ok with there being scaleX and scaleY based off of the image dimensions though.
B
92
S
18
G
9
Posts: 2,455
Reputation: 15,113

Post » Mon Aug 04, 2014 1:06 pm

As ever: what is the scale of an object twice as wide and half as tall? It doesn't have a single scale value.

I don't think it makes any sense at all to return -1 if the X and Y scales are different, because -1 is a valid scale value, making it impossible to distinguish between an object with a scale of -1, and an object with an altered aspect ratio.
Scirra Founder
B
403
S
238
G
89
Posts: 24,653
Reputation: 196,143

Post » Mon Aug 04, 2014 6:25 pm

@Ashley
Tototally right. However ScaleX and ScaleY based on the original image size is doable and does make sense. There are other points of view than the idea of a single ScaleAsBoth values.
B
92
S
18
G
9
Posts: 2,455
Reputation: 15,113

Post » Mon Aug 04, 2014 7:06 pm

A behavior might be in order.
Maybe stick it with some other useful bit, perhaps something like an offset.
Image ImageImage
B
172
S
50
G
183
Posts: 8,442
Reputation: 115,603

Post » Tue Aug 05, 2014 1:37 am

Even if self.scale only works for objects that are uniform.

Also, the way I expected it to work is if an object in the image editor is 10 pixels wide, and 5 pixels tall, then that's the default 1 scale. If I set it to 2 scale, it should be 20 wide and 10 tall. If the object is resized in some way, as soon as scale is reintroduced, it would revert back to its default size. I just figured it would be easier than having instance variables and extra code.

It clearly isn't as simple as I imagine, but it would be nice to get something a little easier to use. It took me quite a while to figure out a suitable method for exactly what I wanted.
@bearboxmedia
www.bearboxmedia.com

Nintendo Wii U Developer using Construct 2
B
84
S
15
G
7
Posts: 991
Reputation: 11,231

Next

Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 7 guests