Cloud UI layer animation

Watch the clouds move by…

This is not a big deal, but today we’d like to share with you the C# script that moves the cloud layers in Volley Brawl.

We created an UI canvas (Background) and put in some child GameObjects (GO) for all the different image layers. The Clouds GO contains the AnimateClouds.cs script:


The CloudsFront and CloudsBack GOs contain the (x-tiled) images that are to be moved. We’ve dragged all that GOs into the respective public GO variables in our script. The Background GO (which contains the canvas) is put into the public Background GO variable, too, so that the script knows about the screen resolution.

You can set the direction the clouds will be moving in the public enum Direction and you can change the speed of both cloud layers separately. If you like, you could add a part to enable the 2 layers, moving into different directions – for Volley Brawl, both layers are moving into the same direction.

Of course, there are thousands of other ways to achieve the same effect. We just wanted to share with you the option we went for.

Keep hacking,

Your Fantasy Arts Team

Share on FacebookShare on Google+Tweet about this on TwitterShare on TumblrShare on LinkedInEmail this to someone

Be the first to comment

Leave a comment

Your email address will not be published.