Posts

Showing posts from May, 2022

Unity Tutorial 6

Image
 Unity Tutorial 6 For this week's tutorials, I learned how to repeat my background. I began by making a new script. I attached it to my background object by dragging it to the inspection side. Next, I had to redo the background in order to create the illusion of an infinite road. I did this by making a new variable and assigning it a transform. positon. Then with a box collider, I made the loop created in the script look seamless. Unity Then I had to make a game over trigger which I had never made before. I added a ground tag to the ground. I added a tag obstacle tag into the obstacle prefab. In player control, I made a game-over variable. I changed the code to have an if-statement to show if the player collided with the obstacle the game would be over Then by making a new script I made the background stop once it triggers the game over. I made a new private player controller script. Then I wrapped the translate method in an if-statement. Then I stopped the obstacle from spawning.

Unity Tutorial 5

Image
 Unity Tutorial 5 I n this weeks tutorials I am starting a new game. First I had to create a new project then I had to download and import the tutorials starter files for this tutorial. Next I browsed around the asset folder before finally choosing my player, animals and food that I would use. I had to adjust the XYZ scale of the food so that it was easily seen. Then I created a C Script and linked it to my player. I made a new public float; HorizontalInput. This is the same variable used in the other tutorials so I was already familiar with it. My player was now able to move from left to right. The next step in the tutorials was new. I learned how to keepmy player inbounds preventing it from falling off the side of the screen. I did this by writing an if-stetement. Unity Next I learned how to make my player throw foods to feed the animals by turning the player into a prefab. After linking the prefab with the player controller I linked it to the space bar using C Script. Then I made th

Unity tutorial 4

Image
  Unity Tutorial 4 For this week's lesson, I learned how to make the vehicle in my game move left, right, up and down. Until this point, the player of my game had no control over the car in the game. With the use of Visual Studio, I was able to add a turn speed variable to my C Script. This made it so my vehicle can move left and right with the keyboard to avoid obstacles.  Unity Next, I was taught how to add breaks and pedals to my vehicle. On Visual Studio I declared a new forward input variable. Then I assigned it to the verticle axis. This gave my keyboard control of the acceleration of the vehicle and allowed my vehicle to stop.  I had some difficulties with this week's tutorial when adding the code onto the C Script. I had forgotten to capitalise the A in GetAxis which threw me off balance. It took me a few minutes of searching and rewatching the tutorial video to figure out where I went wrong. Other than that I found coding in Visual studio to be easy enough to use this

Unity tutorial 3

Image
 Unity Tutorial 3 In this lesson I made my driving game start to function. First Made a script folder and added it to my vehicle then I wrote my very first lines of code in C#, and I was able to change the vehicle’s position allowing it to move forward by placing my code in the Void Update section in the C#. I found this part very tedious as I had to work from two apps; Unity and Visual studio. Although this is my first time using Visual Studio, I think it is easy enough to use. it took me a few minutes to get the app set up. I got used to it fairly quickly.  Next added the physics components to my objects, allowing them to collide with one another. I added weight to my vehicle. I did this by clicking my object going on to inspect and adding a rigid body. This made the game really come to life. I also added some weight to the obstacles too. I also duplicate the obstacles all along the road. When testing out the update I found no issues and was really pleased with the result. Unity In t