How to make background scroll down

I am making a game where the background moves automatically. 

I used this code in a blog post I found:

local bg1 local bg2 local runtime = 0 local scrollSpeed = 1.4 local function addScrollableBg() local bgImage = { type="image", filename="background.png" } -- Add First bg image bg1 = display.newRect(0, 0, display.contentWidth, display.actualContentHeight) bg1.fill = bgImage bg1.x = display.contentCenterX bg1.y = display.contentCenterY -- Add Second bg image bg2 = display.newRect(0, 0, display.contentWidth, display.actualContentHeight) bg2.fill = bgImage bg2.x = display.contentCenterX bg2.y = display.contentCenterY - display.actualContentHeight end 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 local function getDeltaTime() local temp = system.getTimer() local dt = (temp-runtime) / (1000/60) runtime = temp return dt end local function enterFrame() local dt = getDeltaTime() moveBg(dt) end function init() addScrollableBg() Runtime:addEventListener("enterFrame", enterFrame) end init()

The moveBg function cause the background to move up. However I want it to move down.

How do I do this?

You can read the blog post for explanation of code:

http://lomza.totem-soft.com/tutorial-scrollable-background-in-corona-sdk/

Just found out the answer.

At this part:

local function moveBg(dt) bg1.y = bg1.y + scrollSpeed \* dt bg2.y = bg2.y + scrollSpeed \* dt

change dt to -dt.

It should look like this:

local function moveBg(dt) bg1.y = bg1.y + scrollSpeed \* -dt bg2.y = bg2.y + scrollSpeed \* -dt

Just found out the answer.

At this part:

local function moveBg(dt) bg1.y = bg1.y + scrollSpeed \* dt bg2.y = bg2.y + scrollSpeed \* dt

change dt to -dt.

It should look like this:

local function moveBg(dt) bg1.y = bg1.y + scrollSpeed \* -dt bg2.y = bg2.y + scrollSpeed \* -dt