Parallax scrolling

I'm putting some thought into parallax scrolling and was hoping you guys had some ideas on how you think it should be implemented, my first idea was that in tiled you would create each parallax layer in the normal way by creating a Tiled layer and then setting an "IsParallax" property on them, then add some properties for what scroll speed they should have and then in game you would have a Focus Object that might be your player or something else entirely that would cause the world to scroll in relation to it, does this seem right?

Or should the parallax layers simply be images?

I think first option will give more flexibility but might be tedious for you to implement and for us to build. If second option gets you out of the door faster (just images) I think it would work for me. Thanks for keeping at it. Cheers.

I've just done a quick test for the first version and it looks like it should (famous last words) be relatively easy to implement so what I will do is both options :-)

You will be able to build the layers in Tiled and then use them as is or save them out as images (or create images any other way) and use them as well if you like.

Super! Sounds great. Can't wait to try this.

Edit : if one uses option2 can it be made to loop? In other words I might have a map that is 10 screen worth and then I can create a picture that is 3 screen worth. If you can loop the picture it'll create a sense of movement and not get too repetetive yet I will not need to overload the system with a background image that is so huge. Just a thought.

Thanks

I've added basic support for it, have a look in the Beta Updates thread - http://developer.anscamobile.com/forum/2010/12/12/beta-updates#comment-15303

I have made a quick demo here using the current state of parallax, have a play with it to see what needs to be done. It is by no means perfect and there are some changes made to the lime (inc modules) code that hasn't been put into the main version yet so it won't work like it is here with version 2

http://dl.dropbox.com/u/571145/ParallaxScrolling.zip

Everything is set to change as it isn't all that useable right now which is why I need your feedback/ideas.

Each layer has an IsParallax property as well as a property for the parallaxFactor for each axis, either axis could be left out if you wish to.

Graham,

My one observation so far is that if you go to the ends of your world then funny things happen. Normally without parallax Lime will not let you scroll past the left or right edge of your world (I think) but with Parallax you can overshoot and see the background color filling the screen.

Looking & feeling great! Just need to tweak it a little bit I think. Appreciate your hard work. All the best.

KS

Yea I need to put some clamping on the camera so it doesn't go outside the world.

views:1664 update:2011/10/13 16:39:51
corona forums © 2003-2011