Making the background for Win with the Wind
I downloaded an asset package (Cope! Free Skybox Pack) which had three scenes, forest, mountain and sunset.
Once downloaded I added a new skybox component and selected the downloaded scene I wanted.
Now these scenes are not really what I want for my game. I want more of a sky background with clouds and such.
Scene 1 is sunshine and clouds. How do I create this?
I downloaded another asset package (2D Sky Free) and applied a couple of clouds by dragging from the sprites folder onto scene.
But this is still not what I want.
So I created a new material and changed it to skybox in the Shader tab in the inspector.
I added some clouds again.
But no. Still not happy.
By tilting the camera. I got the right ratio of green to blue that I wanted.
That line is a bug or something as the object has been erased. Hopefully it will disappear upon reloading of scene.
Then I realised I need to go in another whole direction. I need to create a scrolling backdrop. The skybox can be changed but shouldn’t really be seen.
So I created a quad and created a material and changed its shader to one of the assets I downloaded.
This is sort of the view, but I want it to scroll up to 500m for the first level.
I created a script called ‘Scroll’ and attached it to the quad.
This controls the speed of how fast the screen scrolls up. But it is still not scrolling correctly and I actually want it to scroll in time with the players kite.
I created a plane and scaled it down to represent a kite.
I will now have to make a script for the kite. A simple script just so the kite responds to my input so I can check the camera stays with the kite as it scrolls upwards.
The left and right inputs worked but the up and down made me go towards or away from the background, which for a 2D game is not good.
So I removed the y axis input and placed it in the z axis. Why this worked is illogical to me which means I need to find out more, later. I am just happy I can control the kite.
But this has just made me realise that I was on the wrong track earlier. I don’t need my back ground to scroll at all. I just need it to be tall enough to ensure that as the kite gets higher, there is still a backdrop to be seen. For the first level this only has to be about 550m, second level 1050m, it is only the third level I have to learn how to create an infinite scrolling back ground.
You know there are times when you feel really dumb, will this is one of those times. I am completely off track with this line of design. Derrrr all I really have to do is create a tall enough back drop for levels 1 and 2 and then attach the main camera to the kite. I unchecked the scroll script and wallah I got what I was initially aiming for. DOH!!!!
Albeit, the next challenge is to actually create an infinite backdrop, as this would cut down on having to actually build a backdrop. In my head, I am thinking two backdrop per level. One backdrop is like the one already made, the second backdrop can be the infinite generating one.
I will now have to work this out as there has to be an easier way of doing it. I am happy I got the kite to move and got the background to scroll at least.
Ok I went backwards and mucked around with a lot of things before erasing a lot of stuff and got it back to its bare bones. I have got the level to keep scrolling up, which is fine but there’s no kite and the background is rather boring.
Putting the kite back in and running it, It does keep scrolling but if I get too high, too low, too left or too right, the kite disappears off-screen. So I need to change that.
In regards to my confusion with the y-axis and pressing the up and down buttons caused the object to go towards or away from the screen and background. I spoke to Lance and asked him why did it work when I changed the horizontal to the z-axis. Lance suggested I look at the inputs and check if the axis have been assigned properly. The vertical axis had been changed to x as well. We changed it to y and changed the script back but no success.
So back to the script.
So my mistake was that I was using Translate in line 13 which makes the object move forward in whatever direction the object was facing. If I clicked on the Kite and looked in the inspector and the object was rotated which affected the direction it considered forward.
Changing line 13 to transform.position to be the new vector3 solved the problem. I also multiplied the x-axis by time.deltaTime to make sure it wasn’t going to fast in that direction as well.
Which then also makes me realise where I went wrong with project one and why I couldn’t get my object to move the way I wanted it to.
That’s all for this little post. Now in the end it did turn out to be a sort of waste of time, in the fact that I was heading in the wrong direction but the fact is that I did learn some more and thus increased my knowledge that little bit more when it comes to scripting.
I also decided to post this info as is, due to come advice from my tutor who has no desire to be ambushed with a massive blog at the end of tri. I am a bit picky when it comes to what I like to put out there and in some ways can be quite pedantic and paranoid but on saying that, tis not good advice to annoy one’s educators and assessment makers of projects. Besides it makes good sense. With the attention span of the average person getting less and less it better to not bombard one with too much too soon. So there shall be more…….
Till next time, thank you for your company.
Gods blessings upon you.