Hi there,
First of all, sorry for the delays... School had started for me and I was in exam frenzy mode.. Well the exams are over now and I have got the results (I scored okay)...
Now back to normal coding & TechViewForum schedule...
So, here it is... Adventures in GameDev Part 1... Enjoy!!!
Okay... Let's start by opening Unity...
You will be presented with a screen similar to this
This is the welcome screen... Now to create a new project... Click on New on the top.... Then you will be present with this
You can give any name to the project you want... But I am going to call it MyFirstGame.. Make sure the radio button is set to 2D.. And also set an appropriate location
NOTE: Unity on default stores the project in the Public Documents folder.. You might want to change that for easier access..We should end up with something like this...
Now press on Create Project!!!.. Then the screen might be blank for a while as Unity will be generating all the project files... (Shouldn't take more than 2 mins)
After all the generation and stuff is done... You will be presented with the iconic Unity Editor...
We will discuss more stuff about editor in the future
NOTE : Your editor may not look same as mine... It is modifiable... Try making your own layout... You can open the views in the Window menu on the menubarSo currently, in our scene (look at the hierarchy view).. We currently have our Main Camera...
Let's change the background color to black to better suit the game...
To do this, we need to first select the Main Camera in the hierarchy view and on the Inspector, click on the box with a color in the background option...
This will pop up a Window for setting up the color...
Set it to black and close the Color selector window
(don't worry... Unity has noted the changes)...
Now, as we have made a change... It's wise to save the Scene (more about it and other Unity concepts in Part 2)
Just press Control + S to save the scene... It is best you make a Folder called Scenes to sort out all the files in your Assets directory (more on that as well on part 2)
Now let's add our characters...
We are going to be adding 2 things today... One is the player, Other is the platform which the player will stand on...
Okay, so I want you to download
this Zip containing the sprites for these... They are both basically squares of different sizes...
Now extract these into a separate folder and keep...
Returning back to the Unity Editor.. Add a folder to the assets directory by right clicking anywhere in the folder view area of the Assets View.
Okay.. Create a folder called Sprites... Go into it and copy the 2 images from the zip into this directory by dragging and dropping...
Well.. Now let's add them into the scene!!! It is easy to add them, Just drag and drop them into the required position...
And adjust them accordingly... Now if we run the game (press the play button up top)... Nothing will happen... It is because we did not add gravity or anything to the player...
Let's do it....
To add gravity to the player... Just select the player object in the hierarchy and on the inspector, scroll down and click on Add Component Button.. You will see a popup... Search on the search bar for RigidBody2D and then click on it...
Now if we run it... Our player will fall into the endless abyss... That's because the Physics engine of Unity does not know how the bodies are shaped... This can be achieved by adding the BoxCollider2D component to the platform and the player in the scene... Try adding it
(it's similar to adding the RigidBody2D to the player)
Then if we run it... We will get something like this...
Well.. We now have accurate physics simulation... We will stop here for now...
In the next part, we will be talking about
Unity Concepts and What we have done today...Feel free to say any suggestions, doubts or if you have any problems below...
Have fun!!!