[REQUEST] Layer scale width or height

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

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

  • I still think It is an essential feature for a game engine. Regardless of my two examples

  • 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

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Bl4ckSh33p , perhaps set the Sprite's scale to a variable and subtract from there?

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

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

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