[suggestion] compare scale

0 favourites
  • That will be handy compare scale of sprite

  • Sounds like a good suggestion. I just looked again, and I'm surprised that this feature isn't already in there.

    With the great OOP (Object-Oriented Programming) in Construct 2, I wouldn't be surprised if Ashley had this implemented within the next few releases.

  • I remember someone asking about this a while ago, and the answer was something like 'scale of height and width can be different, so it wouldn't work'. I agree it would be nice to have an expression for height and width scales, but you can already do this easy enough with the imageHieght/Width expressions.

  • Yeah, it's the same reason there's no 'scale' expression. If an object is twice as wide and half as tall, what's its scale?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Ashley its Simple to calculate sprite size 1241x 452pix half or twice of this value

    Now i use sprite.width +1

    and

    sprite.heiht+1

    Imagine about how much need to add pixels to this sprite of size

    when i want to object decreased or increased equally?

    for example that expression solve this problem sprite.scale -/+0.1 that will be nice and fast as hell

    PS: its hard to me to explain because my english is not wery well but my sugestions is come from my experience with C2. I am a consumer and i know my needs and i know what i need when i work on c2. I try to help you improve c2

  • Ashley I've seen this get asked a lot, it doesn't really affect me so much personally but I think I'm aware as to why it's popping up a lot:

    If an object is twice as wide and half as tall, what's its scale?

    If you have an Sprite that has an imagewidth and imageheight of [32,32], and you then use "Set Size" or "Set Height/Width" actions so that the sprite is now "64,16", then that would mean the scale is still at 1.

    So continuing from the example, you're 32x32 sprite is now 64,16 via "Set Size", if you were to set Scale to 2, I think people would expect the size to go to "128,32", rather than the Scale action reading from the image data and setting its dimensions to "64,64" (which it currently would do).

    This leads me to believe the way that "Set Scale" is implemented is simply doing a formula, reading from the ImageWidth/ImageHeight (and NOT the sprite.width/sprite.height), therefore "Set Scale" is more of a quick formula action, rather than a built-in variable that is storing the Scale value. If this is correct, then I think that's why people are confused at the lack of retrieving a Scale value, because you simply didn't design it that way :P

    Again, workaround is easy but yes. Hope I was of use!

  • Perhaps a tutorial on how to do percentages would be a better idea?

  • I think it's simply incorrect to return a scale of 1 for an object that is twice as wide and half as tall. Returning a scale of 1 would imply the object is at 1:1 scale.

  • I have to agree with Ashley that getting a scale of sprite just would work. however getting a 0-1 percentage of W/H from the original image size would be another matter.

    So what you can do for that at least is

    %W = Self.width / self.ImageWidth

    &H = Self.Height / self.ImageHeight

  • Yeah, it's the same reason there's no 'scale' expression. If an object is twice as wide and half as tall, what's its scale?

    How about not showing/applying such option if current WxH aspect ratio is different from original aspect ratio ?

  • lennaert - that's not possible. The editor cannot possibly know if the object aspect ratio will change at runtime.

  • lennaert - that's not possible. The editor cannot possibly know if the object aspect ratio will change at runtime.

    At the moment the function is called to be applied at runtime, can it not check if the current objects ratio is different from the original? and depending on that apply or not ?

    In the editor you might be able to apply the scale comparision, but if you tinkered with the individual width or height somewhere along the way, changing the ratio, it does not work at run time.

    You could have a console error log indicating ratio difference, ommiting the comparison check, and for example always return 0 or false in this scenario.

  • I think one of the ideas for the foundation of C2 is that the tools be as intuitive as possible. Having things that sudden don't work isn't a good idea.

    Though, one idea is to have another boolean for sprites for "Always maintain aspect ratio". But, it's easy enough to manually do that. Just like an easy way to know the individual scales is using something like what jayderyu said.

    Another idea, is that whenever your set scale for a sprite, then you can have an instance variable that keeps track of that scale. Thus a comparison can easily be done with that.

  • I think one of the ideas for the foundation of C2 is that the tools be as intuitive as possible. Having things that sudden don't work isn't a good idea.

    It wouldnt be sudden, as it would be in the manual, and in the webconsole.

    Though, one idea is to have another boolean for sprites for "Always maintain aspect ratio". But, it's easy enough to manually do that.

    This would generate the same issue you pointed out, it suddenly wouldnt work ? (changing width or height)

    Another idea, is that whenever your set scale for a sprite, then you can have an instance variable that keeps track of that scale. Thus a comparison can easily be done with that.

    These would be off if you changed only width or height.

  • This is unnecessary it can already be done with events...

    Place sprites you want to scale on a single layer, there is a compare layer scale condition...

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