Scratch's glide code is helpful for movement that doesn't directly move up, down, left, or right. However, it's limited because you have to write in directly how long it should take to reach the point. This is especially upsetting when you need a character to travel at a specific speed to a location determined by a variable—the sprite will take the same amount of time to move move to a far and nearby location. This code uses the Pythagorean Theorem to calculate the distance the sprite needs to travel and then uses a speed you can specify to get to that point. Backpack Scratch Cat's code for use in your own projects, and make sure to read the comments in the code so you understand how you can change it for your own use, depending on what you need it for. I added a little game with this project so you can understand this in a more fun way!
Thanks to designworklife.com for the font used in this project. You're completely free to use any of the code in this project without attribution, but mentioning me in your credits would be nice! :D Also, thanks to Greek philosopher Pythagoras for creating the Pythagorean Theorem.