So I’ve been putting in more work on Parallax Scrolling this weekend and have made some promising progress.
There is one main issue currently which is, as always, physics. The main issue is having physics on layers that move at different speeds, i.e. parallax layers. If you have your physics objects on different layers that is fine but they have to move at the same speed so it is best to put them all on the “main” layer, i.e. the one your player, enemies and all other things are on. Which is probably the layer you would want them to be on anyway. You can still have them on ObjectLayers however they must also move at the same speed as the main layer.
With that limitation aside, on to the good stuff; how to get it working. It’s pretty simple really, just add a “ParallaxEnabled” property to the Map and set it to True.
Now for each layer you will want to set a speed factor which is how fast or slow the layer will move in relation to the others, you will probably want your main layer to move at the base speed of 1 so you can just leave it at that and then for layers that are closer to the camera you will want a higher value and then for layers that are further away you will want lower numbers. To set these values simply give the layer a property called “parallaxFactorX” for horizontal and “parallaxFactorY” for vertical. If you leave them out they will move at the base speed of 1.
The map needs a base layer to be able to clamp the camera to, you can either set this manually by adding the property “parallaxBaseLayer” to a layer or letting Lime work it out by picking the first layer, which will most likely be completely fine.
I will be uploading a sample to the Members area soon and also checking in a bunch of new code to the SVN for people that are that way inclined and after a few more people have tested the code in a real world setting outside of my sample project I think it will be time for full release of version 3.1.
[import]uid: 5833 topic_id: 8309 reply_id: 308309[/import]