# x_scale help

M

#### Meve

##### Guest
Hi!
so Im working on a 2d platformer and I have been having some problems with the x and y scale coding
ive tried multiple things
and now i have this:
Code:
``````if (key_left)
{
image_xscale=-3;
image_yscale=3;

if (key_right )
{
image_xscale=3;
image_yscale=3;
}``````
i also used this code in a (simpler) game:
Code:
``````if (hsp >0) image_xscale=2
if (hsp<0) image_xscale=-2``````
the problem is, is that my image gets stretched out when i use that code and i dont know what to do about it.

#### Nexusrex

##### Nexusrex Games
Because you are increasing the scale twice/thrice, you would use 1 and -1 instead

M

#### Meve

##### Guest
Because you are increasing the scale twice/thrice, you would use 1 and -1 instead
yeah I did that already but if i do that the sprite becomes very stretched and i dont know how to fix that

#### Nexusrex

##### Nexusrex Games
Stretched as in yscale? or both xscale and yscale?

#### Nathan Laing

##### Member
You could do;
Code:
``````if (key_left)
{
image_xscale = -1;
}

if (key_right)
{
image_xscale = 1;
}``````
Code:
``draw_sprite_extended(sprite, image_index, x, y, image_xscale, image_yscale, image_angle, c_white, 1);``

M

#### Nathan Laing

##### Member
as in y scale
If this is only about right and left, you do not need to adjust the Y scale. Also, use only values of -1, otherwise you will get stretching.

#### Nexusrex

##### Nexusrex Games
If this is only about right and left, you do not need to adjust the Y scale. Also, use only values of -1, otherwise you will get stretching.
Exactly. The code had image_yscale = 3; which isn't needed.