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

Author Topic: How can I make looped map?  (Read 1330 times)

0 Members and 1 Guest are viewing this topic.

test

  • Newbie
  • *
  • Posts: 4
    • View Profile
How can I make looped map?
« on: October 10, 2015, 10:06:28 am »
I'm making side scrolling game and i want to loop my map, so when the player goes right, map repeats infinitely and enemies, coins and so on generate randomly. How can I do it with SFML?
(click to show/hide)
« Last Edit: October 10, 2015, 10:40:42 am by test »

Satus

  • Guest
Re: How can I make looped map?
« Reply #1 on: October 10, 2015, 01:08:40 pm »
Read this book, there's an example of how to implement what you want:
https://www.packtpub.com/game-development/sfml-game-development

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11016
    • View Profile
    • development blog
    • Email
Re: How can I make looped map?
« Reply #2 on: October 10, 2015, 04:29:52 pm »
If you just want to repeatedly move the background, you just make it longer than the window size and after a certain threshold you reset its position.
If you also have objects flying around, you could rest their position as well.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

test

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: How can I make looped map?
« Reply #3 on: October 10, 2015, 05:28:39 pm »
Thanks, guys. I'll try this.

Hapax

  • Hero Member
  • *****
  • Posts: 3379
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: How can I make looped map?
« Reply #4 on: October 12, 2015, 06:03:26 pm »
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*