# Hello I need some Help? With distance Check

Hello I’m working a adventure game I can’t seem to figure out how to shrink the player when he gets a certain distance I have a background of my road on my home address but the road narrows and gets smaller so i attempted to do an allusion of when the player is close to DetectDist2
so my code is y Position of player is below 50 pixels change height of player sprite to set to 88 and set width to 45

y Position of player is inverted below 70 pixels change height of player sprite to set to 362 and set width to 185

so it doesn’t work is their a better way

if someone could help me out with a solution that’d be great thanks

Are you moving the player via the keyboard? If you provide a screen shot of the current events, we will have more to go on to give help.

That’s the keyboard Set Up I’m using

here’s the code I am using for scalling

I would like the scale to change over time gradually but I tried it on my own can’t seem to figure it out yet

Be careful, height and height’s scale is not the same.

So, If I understood the situation correctly you have a street photograph as a background and you want to scale the character when he goes up or down. If so, you are going about it the wrong way.

Say you have this street in a resolution of 1280x720 (I took a sample photo from pixabay)

You want the character when he is at the bottom of the screen (y = 720) to have a scale of 1 (that is the true size of the sprite) and it should decrease as you move upwards.

With simple mathematics (or if you put the values in excel or google sheets) you can have the street width at the lowest part (y=720) and at the highest part (y=240 in this example) and just set the scale of the sprite to that equation depending on the Y position of the sprite…

I hope this helps you and if you want help with the equations send the picture you have and i will do them for you…

wow thanks meX1Co that’s so nice of you cause I’m not very good at math I’m autistic so thanks

okay here is the background

My play has isometric movement but is not isometric yes it has 8 directions so hence to view I chose

Sure… What resolution do you want your game?

So, try this one… I cut the photograph to 1920 x 1080 and put a sprite from a previous project of mine with perspective movement… Now the size of the the sprite I had was 200x200 but it was still small so I set it that the scale at the bottom (y=1080) would be 4 and changed the equation… Also the speed needs to change like I did since the farther it gets it needs to appear that it moves slower… Try it out and tell me…