我必须建立一个赛车游戏。为此,我使用道路作为背景,我需要向下滚动并重复,以便屏幕始终显示移动的道路,即相对于用户车道,道路似乎正在移动。
答案 0 :(得分:3)
尝试本教程http://mobile.tutsplus.com/tutorials/corona/corona-sdk-create-a-side-scroller-from-scratch/它会向您展示如何制作包含不断移动背景的连续运行游戏。
答案 1 :(得分:2)
仅供将来参考,以下是垂直滚动背景的代码:
local function moveBg(dt)
bg1.y = bg1.y + scrollSpeed * dt
bg2.y = bg2.y + scrollSpeed * dt
if (bg1.y - display.contentHeight/2) > display.actualContentHeight then
bg1:translate(0, -bg1.contentHeight * 2)
end
if (bg2.y - display.contentHeight/2) > display.actualContentHeight then
bg2:translate(0, -bg2.contentHeight * 2)
end
end
完整的教程在这里:http://lomza.totem-soft.com/tutorial-scrollable-background-in-corona-sdk/