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

Author Topic: SFML Scaling  (Read 15403 times)

0 Members and 1 Guest are viewing this topic.

Voroz

  • Full Member
  • ***
  • Posts: 128
    • View Profile
SFML Scaling
« Reply #15 on: December 10, 2009, 04:46:17 pm »
i know this, but it's easier said than done ^^. Atm i am converting the floats to ints before i draw it, but it still shakes for a little while before it stops most of the time.

panithadrum

  • Sr. Member
  • ****
  • Posts: 304
    • View Profile
    • Skyrpex@Github
    • Email
SFML Scaling
« Reply #16 on: December 10, 2009, 06:18:01 pm »
No, it's easier done than said lol

Just do something like this:

x    - your current position
xto - the position you actually go to
sp  - speed of movement

if(x > xto+sp) x -= sp;
else if(x < xto-sp) x += sp;
else x = xto;