I have a sprite that I want to speed up as it gets closer to another object. I really want this to flow well and don't want a series of if statements. All I can think of is to take the distance and have some equation pump out a number that slowly rises as the distance decreases.
But for the life of me I can't think of a way to do this, though I'm sure it's possible. My mathematics knowledge is just too lacking to think of the tools I need for this.
Here's a pseudocode breakdown:
50->(function)->1.2
20->(function)->1.8
Than I'd could do something like:
speed = speed*1.8
I've thought about it and I think this would be similar to gravitation, I've tried some googleing, is there anyone that can point me in the right direction