I want my 2D sprite to become bigger when moving down the screen (closer to the camera), smaller when walking away and to maintain the same size when moving left or right.
The scaling along the y axis is fine but when I move left the sprite remains facing right. I have tied the y_scale
to the x_scale
so the sprite retains the correct proportions. Here is the problem:
For example, if the image_yscale
is currently 9 and I want to move left, setting the image_xscale
to -1 causes the sprite to shrink again. How can I flip the sprite along the x_scale
while retaining the current size?
Here is my code:
// Sprite Scaling
if keyboard_check(vk_up)
{
image_yscale -= 0.01
}
if keyboard_check(vk_down)
{
image_yscale += 0.01
}
image_xscale = image_yscale
if image_yscale < 1
{
image_yscale = 1
}
Thanks for any help in advance.