Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Can you make a sprite move the way it's rotated?  (Read 1386 times)

0 Members and 2 Guests are viewing this topic.

Bonediggerninja

  • Newbie
  • *
  • Posts: 10
    • View Profile
Can you make a sprite move the way it's rotated?
« on: February 08, 2017, 07:13:33 am »
 :) :D  ;D

Can you make a sprite move the way it's rotated?

For example
sprite.setRotation(60);
sprite.move(60); //but in the way it's rotated;

Thanks in advance? 8) 8) 8) 8) 8) 8)

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Can you make a sprite move the way it's rotated?
« Reply #1 on: February 08, 2017, 07:44:19 am »
sprite.move(std::cos(angle) * distance, std::sin(angle) * distance);
Laurent Gomila - SFML developer