Hey guys, Ive been going through the trial and error of the tutorial, but when I run the game, the ground tiles tiles move, but it resets the whole tilesset in front of me instead of just one at a time. Not sure what Im doing wrong.
Can you post a screenshot of how your collection is set up?
Collection looks right. How sbout your ground script?
1 Like
local pieces = { “ground0”, “ground1”, “ground2”, “ground3”,
“ground4”, “ground5”, “ground6” }
function init(self)
self.speed = 6
end
function update(self, dt)
for i, p in ipairs(pieces) do
local pos = go.get_position§
if pos.x <= -228 then
pos.x = 1368 + (pos.x + 228)
end
pos.x = pos.x - self.speed
go.set_position(pos, p)
end
end
Looks right too. Hmmm… The only thing I can think of is that you might have created all tile sprites in the same game object instead of putting one sprite in each of “ground0”, “ground1”, “ground2” etc.