The "draw_sprite_scaled_ext" Function

Syntax

draw_sprite_scaled_ext(sprite, subimg, x, y, ratio, min, max, rot, col, alpha);
ArgumentTypeDescription
spritespriteThe sprite to draw scaled
subimgintegerThe sprite frame index to draw
xrealThe horizontal room coordinate at which to draw the sprite
yrealThe vertical room coordinate at which to draw the sprite
ratiorealPercentage of the view to occupy, as a value ranging from 0-1
minrealMinimum allowable ratio, or percentage of the view
maxrealMaximum allowable ratio, or percentage of the view
rotrealThe sprite rotation angle, in degrees
colcolorThe sprite blending color to draw, where c_white is default
alpharealThe sprite transparency, ranging from 0-1

Description

Draws a sprite scaled relative to the size of the active view camera. Ratio is calculated as a percentage of view width OR height (whichever is greater), with a value of 1 fully covering the view at any aspect (e.g. for backgrounds).

Because this ratio alone may result in sprites smaller or larger than desirable on one axis, a min and max ratio can also be supplied to limit size on the other axis than is calculated for the base ratio (e.g. for HUD elements). If max is set to 0, clamping will be disabled.

Also returns the scale multiplier, which can be used to position or scale other elements relative to the drawn sprite.

Example

draw_sprite_scaled_ext(my_sprite, image_index, x, y, 0.25, 0.15, 0.5, 0, c_white, 1);