Resize object by percentage

New releases and general discussions.

Post » Fri May 02, 2008 8:34 pm

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 :D
B
2
G
4
Posts: 44
Reputation: 1,138

Post » Fri May 02, 2008 10:03 pm

You can basically already do that. For example, to set something to 50 percent of it's orginal size:

[code:1une38wh]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. :?
Moderator
B
98
S
37
G
19
Posts: 1,584
Reputation: 17,817

Post » Sat May 03, 2008 12:52 am

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:

[code:1xuyzra0](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.
B
2
S
2
G
5
Posts: 108
Reputation: 1,866


Return to Construct Classic Discussion

Who is online

Users browsing this forum: No registered users and 3 guests