0 Favourites

Resize object by percentage

This forum is currently in read-only mode.
  • Hey again, another small suggestion - wouldn't it be nice if under "Size & Position" we could resize objects using percentage relative to its original size?

    Making objects gradually grow/shrink is a bit of a pain with "set width/height" if the object is asymmetrical.

    I'm sure some people here can relate

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • You can basically already do that. For example, to set something to 50 percent of it's orginal size:

    Start of layout - Object: Set 'originalwidth' to Object.Width
                      Object: Set 'originalheight' to Object.Height
    
    (Your Event) - Object: Set Width to Object.Value('originalwidth') * 0.50
                   Object: Set Height to Object.Value('originalheight') * 0.50[/code:1une38wh]
    
    It may take a bit more effort, but it should work.  Hope that helps. 
    
    EDIT: Okay, so upon testing this myself, it appears there's a bug in Construct that makes the sprite dissapear when setting the height and width from variables.
  • Just so you know, OriginalWidth and OriginalHeight are already available. For example, if you want to scale to 50%, you can simply do the following:

    (Your Event) - Object: Set Width to Object.OriginalWidth * 0.50
                   Object: Set Height to Object.OriginalHeight * 0.50[/code:1xuyzra0]
    
    If you want to scale dynamically, you just change the '0.50' in the code to a variable.
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)