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

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - mic4h

Pages: [1]
1
Graphics / speed inconsistency (different computers)
« on: March 19, 2012, 07:14:33 pm »
Hi! I'm new btw. Anyway, I have a pong clone copied virtually line-for-line from the "sfml game from scratch" tutorial (he calls it "Pang!"). The paddles and ball move very smoothly on my computer, but are very fast and too sensitive on my friend's computer. Position is updated as follows:

get time and call update():
Code: [Select]
float timeDelta = Game::GetWindow().GetFrameTime();
Update(timeDelta);


inside of update:
Code: [Select]
Update (float elapsedTime){
  if (Game::GetInput().IsKeyDown(sf::Key::Right))
    _velocity += 3.0f;
  GetSprite().Move(_velocity * elapsedTime, 0);
}


My understanding was that this process effectively scales the speed by the framerate so that it doesn't matter how fast or slow a computer is-- the objects should always move around at the intended speed. This doesn't seem to be working though.

Thoughts?

Pages: [1]
anything