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

Author Topic: Scrolling map  (Read 2191 times)

0 Members and 1 Guest are viewing this topic.

Fuv

  • Newbie
  • *
  • Posts: 35
    • View Profile
Scrolling map
« on: June 13, 2010, 05:16:34 pm »
Hello all again,
Unfortunately I have next trouble - now with moving map. I wrote code on two ways and both is not working :(

I need your help then.

My first effort was using this post:
http://www.sfml-dev.org/forum/viewtopic.php?p=5097&sid=f9a1cd64f563b420ac67e1e42a2e2f99

And what I made is:
http://wklej.to/TnAa

And then I tried to do sth myself, but ofc it also doesn't work:
http://wklej.to/f8Nz
Here I even don't see a map :o

Is here somebody willing to help me?

Kind Regards
Fuv

G.

  • Hero Member
  • *****
  • Posts: 1593
    • View Profile
Scrolling map
« Reply #1 on: June 13, 2010, 07:12:09 pm »
You should explain better what your problem is, something more than "it is not working".
Anyway, the velocity of your player is 100px/s but you took App.GetFrameTime() as the velocity per frame of your background (Offset).
Compute your OffsetX and OffsetY (forgot Y at line 49 btw) the same way you're doing it for your player.
OffsetX = 100 * App.GetFrameTime(); Ditto for OffsetY
That is, of course, if you want the view to follow the player. Alternatively you could center the view on the player position with SetCenter.

Maybe you could also read again the thread you linked to. ;)

Fuv

  • Newbie
  • *
  • Posts: 35
    • View Profile
Scrolling map
« Reply #2 on: June 14, 2010, 03:46:50 pm »
I want to thank you so much. Everything is going well.

Thanks for your attention.

Kind Regards
Fuv