I noticed that there was a problem in my tower defense game. I use a stretched costume that acts as the range of the towers and if an enemy enters their range (it switches to the range costume and checks if any enemies are touching) then it shoots the first enemy.
Sometimes it doesn't turn back into the regular costume and other times it just lags the game. I thought of other things, and one thing that I concluded might work is checking if the distance between the tower and the enemy is a certain amount. Though, I am still keeping the costume so I can let the user visually understand how much range a tower has.
I see no reason not to do this, but I can't seem to get the proportion right when I try to multiply pixels as big as distances, it's always too big or too small. I obviously can't guess. I can't just see the costume height or width because that goes by pixels, not differences. I can't make a ruler sprite and check the difference because I don't know how far apart each line will be.
So that is what I need to know. How much do pixels move when you change x by 1? I really need to know the ratio of pixels to 1 X position. Here is the project. Everything else in the project works, I did the distance detection good, but it goes too far, and the towers are shooting enemies outside their range because I did not determine the distance yet.