I added a background in my game.
I made a new object called a "Quad" and removed the mesh collider component from it.
Inside one of the assets folder there is a background picture. I will be using this
So I dragged this texture onto the Quad and it automatically turns it into a material.
So now I had to scale it to fit the entire game screen. So I looked at the resolution of the original image and saw that it's about a 2:1 aspect ratio. So when I scale the Y should always be twice as much as the X value. I ended up with a 15:30 scale ratio at the end and it covered my screen.
Now the background looked very washed out and grey and this is because with Unity 5 the shader is automatically set to standard and the light shining on the texture makes it looks weird. So I had to make a way so that light doesn't shine on the texture, I went to unlit > Texture and it made it look nice and solid.
Now when I went back to game view and looked at the ship it looked kind of off,
And this is because part of the background was covering the bottom and front of the ship (kinda like floating on water). So to fix this I moved the background's Y axis to -10 and it looks fine now.
After I finished the background I worked on the movement code. I made the ship move and also set a boundary on where he can go up to. I did a lot of code and it will be hard to explain everything so I'll just explain what I learned.
I learned how to use the RigidBody Velocity feature to move the ship left right forward and backward.
I learned how to use Mathf.Clamp to set a boundary where the player can't exit.
I learned how to use the RigidBody Rotation feature to tilt the player ship a bit left or right depending on velocity direction.
This is how it looks so far:
Tomorrow I will be continuing the tutorial.
No comments:
Post a Comment