built-in scale variable

0 favourites
  • 5 posts
From the Asset Store
Easily store, modify, read and manipulate colors with Color Variables!
  • Ashley

    I was going to propose to add a built-in scale variable for Sprites. This way you can Set Scale() to a Sprite and then reference what the scale is by using Sprite.scale

    For a while now I've always added "scale" as an instance variable so that I can reference scale. If you did make this change and added a "system" default scale variable, would it break my existing code?

    How does Construct add variables like that so that they are backwards compatible? Also is this suggestion of adding a scale variable a good idea in your opinion? or is there another way to reference the modified scale of a Sprite? Thanks

    Tagged:

  • Are you talking about referencing something like 'is this object scaled twice as large as another object' ? Usually you would set scale based on something else happening. For example if a button is pressed, you could set the scale lower but the check is if button is being pressed, not if the scale or scale variable is 0.5. What were you thinking of using it for?

  • The problem with a scale expression is: if the object is twice as wide, and half as tall, what is the scale? There isn't one, there's only a scale for each axis. So we could probably add a XScale and YScale expression in future, but not a Scale expression.

    Handling backwards compatibility is a difficult question - so far we just try to choose names nobody uses...

  • Are you talking about referencing something like 'is this object scaled twice as large as another object' ? Usually you would set scale based on something else happening. For example if a button is pressed, you could set the scale lower but the check is if button is being pressed, not if the scale or scale variable is 0.5. What were you thinking of using it for?

    currently I'm using scale to add variation.

    Create Object: Cloud
    Cloud Set Angle random(360)
    Cloud Set Instance Value scale to random(0.5,2)
    Cloud Set Scale to self.scale
    

    So if for some reason I want to reference that scale, I have to save it in a variable, there's no easy way to get the exact scale from the width and height. I'm sure you could math it, but I feel it would be easy to be off by a decimal.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Ashley

    The problem with a scale expression is: if the object is twice as wide, and half as tall, what is the scale? There isn't one, there's only a scale for each axis. So we could probably add a XScale and YScale expression in future, but not a Scale expression.

    I didn't think about that. I guess because when you use the scale Action you only supply it with one number assuming you want to keep aspect ratio. If you want it distorted you then set with the height/width separately.

    but yes X/Yscale would work well I think. And I think those values are already in the editor! But you could potentially make a .ARscale (aspect ratio scale) so that it supports the Scale Action.

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