SPRITE_X_SCALE

SPRITE_X_SCALE N,CX

SHRINKS OR STRETCHES THE WIDTH OF TH SPRITE NUMBER N

  • Type: Command
  • Parameters: 2
  • Group: SPRITE

ACTION

The command SPRITE_X_SCALE N,CX scales the size of the SPRITE designated by its number N, along the X axis that is its width, by the coefficient CX. The size on Y is unchanged (its height).

In a SCENE2D, the X axis is the horizontal axis, the Y axis is the vertical axis.

If CX=1, no scale is made on its width.

If CX>1, the SPRITE is stretched on the X axis (width).

If CX<1, the SPRITE is shrinked on the X axis (width).

SYNTAX: SPRITE_X_SCALE N,CX

  • N = SPRITE number (integer or real). Must be greater than 0 and less than or equal to the allowed maximum number of SPRITE objects.
  • CX = integer or a real coefficient. Must be greater than 0.

USE

  • The command SPRITE_X_SCALE is used to change the width of a SPRITE.

ERROR

  • If the SPRITE number N does not exist.
  • If the coefficient CX is not a correct expression.
  • If the coefficient CX is less than or equal to 0.

EXAMPLE

rem create a 2D world number 1

scene2d 1

rem load a background picture

file_load 1,"city.bmp"

rem create a SPRITE number 1

sprite 1

rem load a picture to the SPRITE

sprite_file_load 1,"alien.bmp"

rem place the SPRITE on the SCENE2D

sprite_x_position 1,150

sprite_y_position 1,250

rem double the size of the SPRITE on X axis

sprite_x_scale 1,2

SEE ALSO

SPRITE_Y_SCALE