Set Instance Scale Icon Set Instance Scale

This action block sets the image_xscale and image_yscale values for the instance. The input values here are modifiers which will be applied to the sprite assigned to the instance, where a scale of 1 (the default value) indicates no scaling (1:1), smaller values will scale down (0.5, for example, will halve the width of the sprite), and larger values will scale up. You can use negative values to flip the sprite and scale it unless the value used is exactly -1 (in which case the sprite is just flipped or mirrored about its origin with no scaling). You can choose to set the horizontal or vertical scale relative to the current values, in which case you will be adding or subtracting the new value from the current scale values.

NOTE Changing these values will also change how the instance detects collisions, unless you have supplied a separate mask_index (collision mask) in The Object Editor. Please note that for changes in this variable to be visible, the instance should have either no draw event (and so GameMaker will default draw the sprite) or be drawn using Draw Self action.

Examples of scaled sprites

 

Action Syntax:

Set Instance Scale Action

Arguments:

ArgumentDescription
HorizontalThe vertical scaling factor to use (default is 1).
VerticalThe horizontal scaling factor to use (default is 1).

 

Example:

Set Instance Scale ExampleThe above action block code sets a new sprite as well as a number of other properties for how that sprite is to be displayed, including setting it to scale to three quarters of its base size along both axis.