Struggling trying to get parallax to work for my horizontal scroller game. Anyone able to identify what the layer properties I require are? What I’m doing wrong.
So it’s basically a test simulating a horizontal scroller. The camera moves from left to right along the game. What I’m after is for the background images (in the top left) to enlarge to form the full height off the screen, then move more slowly in the background (parallax) and wrap around. Can’t seem to get it happening.
Main Code
display.setStatusBar( display.HiddenStatusBar ) -- Load Map local mte = require('mte').createMTE() --Load and instantiate MTE. local map = mte.loadMap("map.tmx") --Load a map. -- Zoom so map fits vertically (i.e. horizontal scroller) local yZoomFactor = (display.contentHeight / map.height) / map.tileheight mte.zoom(yZoomFactor, 10) -- Camera local mapObj = mte.setCamera({locX = 1, locY = 1}) --Set initial camera position and map scale. mte.constrainCamera() mte.update() -- Move Camera left-to-right to simulate horizontal scroller mte.moveCameraTo({locX = 50, locY = 10, time = 20000}) -- Gmae Loop local gameLoop = function(event) mte.update() --Required to process the camera and display the map. end Runtime:addEventListener("enterFrame", gameLoop)
Level Concept
Current Background Parameters
Project Zipped