Why isn't Scale an expression

0 favourites
  • 11 posts
  • 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?

  • This was explained maybe less than two months ago in another thread.

  • 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?

  • I think it's a no-brainer: return -1 if the scaling is not symmetrical, otherwise return the object's scale.

  • 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.....

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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.

  • 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.

  • 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.

  • A behavior might be in order.

    Maybe stick it with some other useful bit, perhaps something like an offset.

  • 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.

  • AnD4D : in general, you'll need a parent/child relationship to scale a non-uniform object in a uniform way -you scale the parent instead of the child. But well, Construct doesn't handle per-axis scale, so you should use your own height and width ratios instead (store the initial height and width, and do your scaling operations from that using a function).

    To me anyway, the scale is rarely useful as it is.

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