GLBasic forum

Main forum => GLBasic - en => Topic started by: freshworks on 2009-Oct-28

Title: Parallax scrolling -> help
Post by: freshworks on 2009-Oct-28
Hi,

I'am looking for some code examples to implement in a project i'am develiping for the iphone.

Will there be any possibility for the iphone to manage parallax scrolling ?

Thanks,
Freshworks
Title: Re: Parallax scrolling -> help
Post by: MrTAToad on 2009-Oct-28
I dont see why not - it should be able to copy with anything from simple starts to the parallax scrolling a-la Altered Beast.
Title: Re: Parallax scrolling -> help
Post by: freshworks on 2009-Oct-28
Also very interesting, what are the formulas of moving each layer (sprites) when parallaxing , does anyone knows ??
Title: Re: Parallax scrolling -> help
Post by: MrTAToad on 2009-Oct-28
It would depend on what you want to scroll.  With star fields, the colour (and thus distance) would determine how fast they mode - dark grey (being further away) would scroll much slower than ones that are white (which are close)

With something like Altered Beast, the different levels scroll slower the further away you get - this also applies to the clouds as well.

See :

http://en.wikipedia.org/wiki/Parallax_scrolling (http://en.wikipedia.org/wiki/Parallax_scrolling)
http://en.wikipedia.org/wiki/Parallax_scrolling (http://en.wikipedia.org/wiki/Parallax_scrolling)
Title: Re: Parallax scrolling -> help
Post by: freshworks on 2009-Oct-28
Hi, MrTaToad

i like to accomplish something like this : http://www.youtube.com/watch?v=JVowHErySnc
Title: Re: Parallax scrolling -> help
Post by: MrTAToad on 2009-Oct-28
That should be fairly easy - looks like just the forground (actual level) and a background graphic which rotates and moves only slightly slower than the player.

You would need a bit background map - probably 2/3 times the size of the play area (or possibly the screen if you want a wrap around effect).  As you'll know the movement speed and rotation speed, you'll just move and rotate the background by a factor of this.
Title: Re: Parallax scrolling -> help
Post by: freshworks on 2009-Oct-28
Any change of putting some pseudo together for implementation in GLB ?
Title: Re: Parallax scrolling -> help
Post by: MrTAToad on 2009-Oct-28
I'll see if I can come up with something
Title: Re: Parallax scrolling -> help
Post by: freshworks on 2009-Oct-28
Thanks MrTAToad, that would be very nice
Title: Re: Parallax scrolling -> help
Post by: MrTAToad on 2009-Oct-28
I've got a very basic 2 level parallax scrolling system included - the background stars rotate and move at a slower speed than the planet.

Unfortunately movement isn't quite correct, but you should get the idea.

I do have a non-GLBasic one here : http://www.miscthings.co.uk/darkgdk.html (http://www.miscthings.co.uk/darkgdk.html).  Unfortunately its in C

[attachment deleted by admin]