Need Help on Smooth Mouse Follow
Hello everyone! I've been working on a feeding frenzy style game and I want the player's fish to follow the mouse smoothly.
I've tried having the fish actor accelerate towards the mouse position (as well as using move to and constrain, neither of which were smooth enough) but the fish would have to much speed and momentum to stop. Ideally, I would like the fish to move faster the farther the mouse gets away, with a limit on top speed, and have it be going slow enough when it reaches the mouse to stop. If anyone has any suggestions that would be fantastic! Cheers!
I've tried having the fish actor accelerate towards the mouse position (as well as using move to and constrain, neither of which were smooth enough) but the fish would have to much speed and momentum to stop. Ideally, I would like the fish to move faster the farther the mouse gets away, with a limit on top speed, and have it be going slow enough when it reaches the mouse to stop. If anyone has any suggestions that would be fantastic! Cheers!
Comments
constrain self.motion.x to: (mouse.x - self.pos.x)*5
constrain self.motion.y to: (mouse.y - self.pos.y)*5
Increase the 5 on the end to make movement more sensitive. This is a basic way to make an actor follow something.