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
https://deluxepixel.com
Both sides of the middle of Tilemap should look equal