|
I would like to made a 2D scrolling game (up,down,left,right) which uses parallax with its background. So the player would appear to move slowly across of it. Any pointers on how to go about accomplishing this task?
(comments are locked)
|
|
Multiple "planes" (at least the front of which with transparency) at different depths, "moving" at different speeds relative to the camera. You "planes" could be planes or cylinders or spheres as you like. "Moving" your background is up to your discretion. If using tiled textures, then you would simply change the offset. If using the actual geo, you would move them at different speeds. An alternative setup is to have a second camera render your different depth to a RenderTexture, but that is Pro-only and somewhat overkill. Haha, you're the one that posted on the link I posted =).
Dec 13 '10 at 04:19 PM
Justin Warner
I am, but that question was looking for a custom camera rotational control, hence why I provided a different and much simpler answer here.
Dec 13 '10 at 04:21 PM
skovacs1
Without the pro version, you can also use multiple cameras to achieve a parallax effect, and it's actually as easy - or maybe easier - than the method described above. All you have to do for this to work is to assign your scene objects to different custom layers (e.g. Foreground, Background1 and Background2). Next, you'll have to set the 'Depth' value of your cameras, so they are rendered in the correct order (back to front) and 'Clear Flags' needs to be set to 'Depth only' for all cameras except the one rendering the farthest background. Then, the only code required is to move the background cameras at a slower speed than the foreground camera.
Oct 20 '11 at 08:17 AM
bernardfrancois
(comments are locked)
|
|
Enjoy =). I'd personally make a cylinder big enough, apply the background, and just have the cylinder to rotate, but then again, that'd be a horrible way of doing it, haha. I think this is a lot more complicated than what I need, thanks though. I'm sure it will come in handy sometime.
Dec 13 '10 at 04:55 PM
spaceshooter
(comments are locked)
|
|
Some great answers here. I'm gonna try adding 3 planes, one behind the other and just adjust the speed of them scrolling depending on their position relative to the camera. Closest scrolls fastest, etc... Thanks for the tips guys and gals!
(comments are locked)
|
