- Home /
tessalating background?
heyy i am creating a 2D game and i need a repeating background i was wondering how you would code this in javascript due to not being able to find any tutorials.
i have a couple ideas for example
you have three planes and as you go onto one the one behind is destroyed and placed in front of you.
or a cube that rotates over and over again giving you a never ending background i have fought about using skyboxes but i cant seem to get more than one background to use so that i can change a scene.
The game that i am creating at the moment is a car chasing game for example spy hunter if any one can help please do any ideas of tutorials would be gratefull my email is parryt48@yahoo.com please help
Answer by robertbu · Mar 15, 2013 at 03:59 PM
One easy way to do this is to change the offset. First you make a single texture that tiles. Then you animate the Material.mainTextureOffset. There is an example script in the reference that animates it with time. I don't know the mechanics of your game, but you could make the plane a child of the camera, and change the mainTextureOffset with the movement of the character.
Answer by parryt · May 15, 2013 at 12:25 PM
thanks yee i tried this but it didnt get me the required effect what i ended up using is a wheel and then i put the materials onto that as the character rises so does the wheel but it also rotates as you go up giving you the effect i needed then based on the characters y axis it changes the materials at certain heights
Your answer
![](https://koobas.hobune.stream/wayback/20220613094456im_/https://answers.unity.com/themes/thub/images/avi.jpg)