Quick Links: Gideros Home | Download Gideros | Developer Guide
Can I use tiledMap for an endless background game?
  • 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
  • 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.
  • Yan +1 -1
    Member
    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

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Login with Facebook Sign In with OpenID

In this Discussion

Top Posters