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 1319 times)

0 Members and 1 Guest 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: 32504
    • 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