Parallax Help - What layer properties do I need here?

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

level_Pic1.png

Current Background Parameters

background_Properties.png

Project Zipped

Any answer to this ? I can’t it to work, too.  :frowning:

Dyson gave me a “fix” for this back in April however (which was “0v984-7”).  I haven’t got back to this however so this fix now be in his latest release.

Was that a bug or a configuration error ? Because it works greatly in the Sonic sample. Could you tell me how you’ve got it to work ?

Thank you !

my issues were a while back before v990, so wouldn’t be valid now… but Dysons response at the time was as follows, if this helps.  Best to get an update from him.  Note that in the end I didn’t get it work how I wanted…

Me: 

Something I noticed when zooming in & out at the end of a level re Parallax.  It currently doesn’t show the view as it is and just zoom in/out, but seems to apply some sort of 3D zoom effect.  I’ll try to show with the following snapshots of the level.  If you look at the mountains in the background which at the beginning take up the whole screen vertically, and then later this is not the case.  

Dyson: (2nd May) 

I finally have some useful information for you! There was a bug, which I corrected for MTE 0v990 coming out in a week or so, but part of what you’re seeing is expected behavior. When you zoom in or out the engine has to move the camera to prevent it from leaving the camera constraints you’ve set. The parallax layers move in response to this, but it doesn’t look quite right to the eye. The visual cues seem to tell us that the non-parallax layers are only zooming out, and as such the parallax layers should only be zooming out as well. This isn’t true, as I mentioned. As the camera zooms out it bumps into the constraint at the end of the level and starts to slide to one side to compensate. This movement is masked by the zooming, leading to our confusion.

 

In your case using a camera constraint might not be the way to go. Instead of constraining the camera, I suggest you increase the width and height of the map and use physics objects to confine the player in a central portion away from the map edges. You’ll want to include enough “safe zone” around the playable area so that the minimum zoom won’t expose the edges of the map. You can use mte.alignParallaxLayer(layer, “center”, “center”) to position the parallax layers where they would have been positioned by constrainCamera(). 

 

The effect of this is that zooming out won’t push the camera around, and everything will appear to remain lined up properly.

Hi greg886, I updated to MTE v990 and it worked perfectly ! Thank you for your answer.

Unfortunately, my game is lagging a LOT on a 3GS, now that I’ve put parallax layers, and it didn’t use to. Have you got performance issues too ?

Any answer to this ? I can’t it to work, too.  :frowning:

Dyson gave me a “fix” for this back in April however (which was “0v984-7”).  I haven’t got back to this however so this fix now be in his latest release.

Was that a bug or a configuration error ? Because it works greatly in the Sonic sample. Could you tell me how you’ve got it to work ?

Thank you !

my issues were a while back before v990, so wouldn’t be valid now… but Dysons response at the time was as follows, if this helps.  Best to get an update from him.  Note that in the end I didn’t get it work how I wanted…

Me: 

Something I noticed when zooming in & out at the end of a level re Parallax.  It currently doesn’t show the view as it is and just zoom in/out, but seems to apply some sort of 3D zoom effect.  I’ll try to show with the following snapshots of the level.  If you look at the mountains in the background which at the beginning take up the whole screen vertically, and then later this is not the case.  

Dyson: (2nd May) 

I finally have some useful information for you! There was a bug, which I corrected for MTE 0v990 coming out in a week or so, but part of what you’re seeing is expected behavior. When you zoom in or out the engine has to move the camera to prevent it from leaving the camera constraints you’ve set. The parallax layers move in response to this, but it doesn’t look quite right to the eye. The visual cues seem to tell us that the non-parallax layers are only zooming out, and as such the parallax layers should only be zooming out as well. This isn’t true, as I mentioned. As the camera zooms out it bumps into the constraint at the end of the level and starts to slide to one side to compensate. This movement is masked by the zooming, leading to our confusion.

 

In your case using a camera constraint might not be the way to go. Instead of constraining the camera, I suggest you increase the width and height of the map and use physics objects to confine the player in a central portion away from the map edges. You’ll want to include enough “safe zone” around the playable area so that the minimum zoom won’t expose the edges of the map. You can use mte.alignParallaxLayer(layer, “center”, “center”) to position the parallax layers where they would have been positioned by constrainCamera(). 

 

The effect of this is that zooming out won’t push the camera around, and everything will appear to remain lined up properly.

Hi greg886, I updated to MTE v990 and it worked perfectly ! Thank you for your answer.

Unfortunately, my game is lagging a LOT on a 3GS, now that I’ve put parallax layers, and it didn’t use to. Have you got performance issues too ?