chemterew.blogg.se

Build a rc car game
Build a rc car game








  1. #BUILD A RC CAR GAME UPDATE#
  2. #BUILD A RC CAR GAME PLUS#

To do this click on the car object in your hierarchy. Importance of sorting layersīefore we attempt to control our player let’s just fix all our sorting layers. So go over to the car.png file and drag it into the hierarchy. Creating car controller for our unity 2d gameįirst thing we want to do is just bring our car into our scene. Great next we need to create the car controller for our game. If you have done all correctly you will end up with this. Then simply drag the ScrollingBackground script onto the quad and check the xAxis check box. Go back up one folder and select your clouds and make sure you have repeat select and click apply. On the right you will need to select rendering mode fade like this. Then go ahead and select your clouds material. If yours does not look like this you may need to adjust your clouds material. Then go ahead and drag and drop your clouds.png onto your quad so that it looks like below. So again add a new quad to your scene.Ĭall it Clouds. Adding clouds using a similar concept as the scrolling background If you have done everything right you should end up with this. I have set the scrolling speed to 1 to give it a reasonable scrolling speed. Once you have your script ready go ahead and drop it onto your Background quad like below. Then we do a check for which axis we are scrolling on and apply a texture shift on that axis.

#BUILD A RC CAR GAME UPDATE#

Then finally in our update method we will calculate our offset which takes our time and multiplies it by our scroll speed. In the start method we will get our renderer component and assign it to rend. This is so we can control which direction we will scroll in. Then we setup a scrollSpeed and add a xAxis boolean. ("_MainTex", new Vector2(offset,0)) įirst we declare a renderer which will give us access to our Quads material. Start is called before the first frame update Public class ScrollingBackground : MonoBehaviour Once done, right click again and create a new c# script called ScrollingBackground.cs. Go ahead and create a new folder called scripts. We going to add some additional options to our script to allow us to scroll other items as well. We now need to just create a script to control our background scroll. Then on the right make sure to change the setting in the screenshot below and click apply once done. To do this go over to your project tab and click on the road.png file. Once this is done we need to tweak a few settings first of which is we need to change our sprite to a repeat sprite. unity 2d racing game tutorial – light for road Once that is done you should have your background light up like this. We now want to add a light to light up our scene so right click in the hierarchy and click and create a directional light. Next take your background sprite and drag it onto the quad. Rename it to Background and resize it to fit the viewport or scene size like so. Scrolling background for our unity racing gameįirst create a 3d quad which we can use in our scene to texture our background onto. Let us now start on the first portion of getting our game to work. That should get your project ready for building to mobile. Then click on player settings so we can change to portrait.Ĭhange the following option below to portrait. Next we want to configure our build settings for our game to be in portrait mode.

#BUILD A RC CAR GAME PLUS#

To do this click on Free Aspect to get a drop down like this.Ĭlick on the plus at the bottom to add a aspect ratio. So go ahead and add a new aspect ratio which is 9:16 for portrait. We no need to add a aspect ratio which will fit a mobile device. Let first setup our scene to fit our mobile screen. Let’s get started with a blank new unity project. Check and confirm your email and we will send you your project. You have successfully joined our subscriber list.










Build a rc car game