Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local function setUpBG()
- local bgGroup = display.newGroup()
- scene.view:insert( bgGroup )
- bgGroup:toBack()
- local bgImages = {
- { file = "filename1.png", width = width, height = height, x = x, y = y, speed = scalar },
- { file = "filename2.png", width = width, height = height, x = x, y = y, speed = scalar },
- { file = "filename3.png", width = width, height = height, x = x, y = y, speed = scalar },
- { file = "filename4.png", width = width, height = height, x = x, y = y, speed = scalar },
- { file = "filename5.png", width = width, height = height, x = x, y = y, speed = scalar },
- { file = "filename6.png", width = width, height = height, x = x, y = y, speed = scalar },
- { file = "filename7.png", width = width, height = height, x = x, y = y, speed = scalar },
- }
- for i = 1, #bgImages do
- local bgImage = bgImages[ i ]
- local image = display.newImageRect( bgGroup, bgImage.file, bgImage.width, bgImage.height )
- image.data = bgImage
- end
- end
- local function drawBG( x, y, bgGroup )
- for i = 1, bgGroup.numChildren do
- local child = bgGroup[ i ]
- local data = child.data
- child.x = data.x - x * data.speed
- child.y = data.y - y * data.speed
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement