Quick Links: Download Gideros Studio | Gideros Documentation | Gideros Development Center | Gideros community chat | DONATE
Can I use tiledMap for an endless background game? — Gideros Forum

Can I use tiledMap for an endless background game?

Unknown Member
edited September 2017 in General questions
I got a tiledmap to work where the hero runs to the end of the map, jumping or climbing to avoid physical obstacles, hits a door, and goes into the next level.

Can I use the same method but instead of going into the next level, the tiledmap restarts from the beginning to have the hero running endlessly with a continuous endless background? I tried resetting the X-coord to the beginning, but that only re-displays the graphics, and all of my physical bodies are all messed up not aligned with my graphics.

Is there a better way to do this type of game?


function Level:onEnterFrame()
if self.started then
if self.hero.moving then
-- at the end of map: stop world moving
print (self.map:getX())
if self.map:getX() < -2400 then
-- self.map:setX(-240)
self.hero.moving = false
else
-- moving map(x, y)
self.map:move(-3, 0)
self.frame = 0
end
end
self.frame = self.frame + 1
world:step(1.5/60, 8, 3)
end

Comments

  • Yes, just have a duplicate of the first part of the map at the beginning, or use the scroll function to only do a fine scroll and feed in one edge.
    Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!).
    https://deluxepixel.com
  • YanYan Member
    edited October 2017
    TileMap should be twice as device width. Then you should move it from right to left, as half tilemap goes offscreen, just reset position to beginnig.

    Both sides of the middle of Tilemap should look equal
    Безымянный.png
    1084 x 584 - 15K
    vk.com/yan_alex
Sign In or Register to comment.