I’m trying to have a sprite swap places with another sprite. So far I think I can somehow use the slope between the two sprites’ original location to move them, but I’m lost as to how to increment their position along that slope.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You’ll need to create a vector between the two sprites, normalize it, multiply that normalized vector by how much you want the sprite to move per frame, then add that vector into the sprite you are moving’s location. You didn’t specify a language, so here is a little pseudo code: