I would like to create a background scrolling for my game.
But I am stuck on it, how can I tell my background listeners to create another background object when current background reach .y <0? Coz my background is scroll up
Also, I am able to create object, scroll up, but I wonder how can I removeSelf when it reach y<= -50, meanwhile, stop it’s listener
Thanks for the guide, gurus [import]uid: 10373 topic_id: 7960 reply_id: 307960[/import]
Take a look at Beebe Games Ghost vs Monsters. In that example, it has transition from right to left. That should put you on the right track. [import]uid: 11809 topic_id: 7960 reply_id: 28339[/import]
Thanks all for providing me the solution.
it DOES worked to loop my background!
but the Ghost & Monster example doesn’t really suitable
Coz if i wanna randomly create diff birds, in different location (different Y coordinates) to fly from right to left?
The background example doesn’t work this way. there should be a Runtime function to spawn a random bird in different y coordinates [import]uid: 10373 topic_id: 7960 reply_id: 28468[/import]
– fps x delta ~= 1 sec
– if need to spawn every 3 secs, then
local fps = 20
local fDelta = 1000 / fps
local spawnPlatformRate = 1 * fps * fDelta
local function spawnPlatform()
print(‘spawn platform’)