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.
 
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
 
You could do;
Code:
if (key_left)
{
image_xscale = -1;
}
 
if (key_right)
{
image_xscale = 1;
}
Then in your DRAW event,
Code:
draw_sprite_extended(sprite, image_index, x, y, image_xscale, image_yscale, image_angle, c_white, 1);
 
Top