Wednesday, September 30, 2015

Unity Day 13 (Space Shooter Project)

What I Did:

      Today I begun by making the player ship shoot the projectiles, to start this off I created a new empty game object and named is Shot Spawn. I then made it a child to the player ship. After that I reopened the player controller script to add some code to make the shots fire.

public float fireRate;
private float nextFire;

void Update ()
{
if (Input.GetButton("Fire1") && Time.time > nextFire)
{
nextFire = Time.time + fireRate;
Instantiate(shot, shotSpawn.position, shotSpawn.rotation);
}


}

     Moving on to the next tutorial I will be creating a boundary to destroy the shots that have moved off the screen. It will be a box that will also deal with the hazards that will be implemented into the game later. I first created a cube, naming it boundary, and scaled it to fit the cameras view. I then made it a trigger and attached a new script to it telling it to destroy every thing that leaves the cubes area.



What I Learned:

     I learned a method of how to rapidly spawn and destroy objects as needed for a game.

What I'm Doing Next Day:

     Next day I will be creating the first hazard for the space shooter game for the player to destroy.

Tuesday, September 29, 2015

Unity Day 12 (Space Shooter Project)

What I Did:

     I wrapped up the movement tutorial by setting the boundaries with variables named xMin, xMax, zMin, zMax. These where set under a class so they where more organized in the inspector. I set the values so the ship would always remain on the screen, and that there was some room near the top of the screen for obstacles. I also added a variable to add tilt to the player ship when moving along the x axis. To do this I added a variable called tilt and and added the line of code,

rig.rotation = Quaternion.Euler (0.0f, 0.0f, rig.velocity.x * -tilt);

and set the tilt value to 4. Now the ship tilts when it moves left and right.

     Moving on to the next tutorial I will be creating the shots for the player ship to shoot. To start this off I created a new empty game object and named it bolt. I then created a quad and made it a child object to the empty one. I created a new material under the materials folder and dragged the fx_bolt_orange texture from the texture folder onto the materials texture setting. I then dragged the newly created material onto the quad. The bolt was on the quad but the rest was black so I then needed to change the shader so that black was shown at 0 and white was a 250. I also added a cylinder collider and deleted the old mesh one. After i resized the mesh collider I dragged the bolt object to the prefabs folder making it a prefab. I then added a rigidbody component and a script to the bolt game object and coded in a variable that makes the bolt move forward.



What I learned:

      I learned how to create a bolt like texture and fade away unwanted colours such as a black background.

What I'm Doing Next Day:

     Next Day I will be adding code to make the ship shoot these bolts.

Monday, September 28, 2015

Unity Day 11 (Space Shooter Project)

What I Did:

     I spent most of today working on fixing the 2 errors from last class which where both fairly obvious after discovering them. The first one where I said....

void Start ()
{
     rigidbody = GetComponent<Rigidbody>();
}

....rigidbody needed to be replaced with rig since I declared the Rigidbody function to be set as rig.

     The second error took me the longest to figure out unfortunately, but i did in the end find it.

The Error:

     The { containing the shown lines of code where supposed to be (, I'm assuming i was confused by the format of this code.

Fixed Code:


What I Learned:

     I learned to check punctuation just as carefully as spelling since that can mess your code up just as easily.

What I'm Doing Next Day:

     Next Day I will be finishing up the last few minutes of moving the ship and move on to creating the projectile shots that will be fired by he ship.

Thursday, September 24, 2015

Unity Day 10 (Space Shooter Project)

What I Did:

     Today I started work on getting the player ship to move. I started by adding a rigidbody component to the player game object. I then created a new script for the player ship, however upon finishing the more basic code i had an error. I fixed this by seeing that i named the script incorrectly, and after changing that the error was fixed. After adding additional code to add boundaries i encountered 2 more errors.



What I Learned:

      I learned how to move a game object at a given speed.

What I'm Doing Next Day:

     Next day I will be fixing my 2 errors with the code and hopefully finishing up this tutorial.

   

Tuesday, September 22, 2015

Unity Day 9 (Space Shooter Project)

What I Did:

     Today I will be finishing off the last tutorial I left of on, first I will be adding the Rim light by duplicating the fill light and renaming it to the rim light. I then readjusted its position to hit the ship from behind and slightly underneath. I then created an empty game Object, and dragged all the lights into it to help organize the the hierarchy. I moved the empty game object 100 units up so the lights where out of the way.

     Moving on to the next tutorial I'll be adding a background. I created a quad object and dragged the nebula texture onto it from the texture folder. I then re scaled it to properly fit the screen being 15 by 30 units large so it did not distort the image either. I then changed the shader to be unlit so it wasn't effect by the lighting system created for the ship. I also lowered the background by 10 units so it wouldn't be clipping into the ships model.


What I learned:

     I learned how to drag custom textures onto objects and how to use shader to manipulate the lighting even more.

What I'm Doing Next Day:

     I will be adding code to a script that will make the player ship move.

Monday, September 21, 2015

Unity Day 8 (Space Shooter Project)

What I Did:
     
     Starting off this week I'll be starting the next tutorial for the project for the camera and lighting. I Adjusted the camera to be above and look down on the ship and had it a bit ahead of the ship so the ship will start closer to the bottom of the screen. I then adjusted the light to shine brightly on one side of the ship, and made a fill light to help light the other side of the ship so its not totally dark.



What Did I Learn:

     I learned how to adjust lights to give a more dynamically lit scene.

What I'm Doing Next Day:

     Next day I'll be finishing the last bit of this tutorial and moving on to the next one which will be adding the background.

Friday, September 18, 2015

Unity Day 7 (Space Shooter Project)

What I Did:

     Today I am starting on the next tutorial showing how to make a top down space shooter arcade style game. I first had to download and import the assets needed from this project and saved the scene as main. This was essentially all that was part of the first tutorial that wasn't covered in the roll a ball project.

     Now I will be setting up the player game object. I dragged the player_ship model from the imported files into the hierarchy, and gave it a mesh collider to detect collisions. I then added the engine visual effect as a child to the player ship game object.


What I learned:

     I learned how to import external assets like models and special effects into unity.

What I'm Doing Next Day:

     Next day i will be adjusting the lighting and camera in the next tutorial.

Thursday, September 17, 2015

Unity Day 6 (Roll a ball project)

What I Did Today:

     I started the class by fixing the error from last class which took longer the i had hoped. The problem was when I added the function countText i didn't say what it was.

Example....
Before:

public countText;

After:

public Text countText;

     Now to finish the tutorial i referenced the count text ui to the player script's count text. It now counts the cubes as they are collected. I created another text and renamed it "Win Text" to display upon collecting all 12 cubes. I did this by using simaler code to the last text except having instead of having it count it displays "you win" when counts value is equal to 12. 


     Moving onto the next and final tutorail I'll be building and deploying the games standalone version. To build the game i pressed shift, control and b to open up the build window. I then selected the platform and the scene i wanted to build, once done i selected build and then chose where i wanted it to save and unity build the game.

What I learned:

     I learned how to create a build to game, and how to display a text based on another variables value.

What I'm Doing Next Class:

     Next Class i will be starting a new unity project.

Wednesday, September 16, 2015

Unity Day 5 (Roll a ball project)

What I Did:

     Today I have started the next tutorial segment on the unity site showing how to pick up the pick up game object. The first the I did was recheck the active box under the players transform so its visible again. I then reopened the player controller script to edit it. Within the code I added code to call on a tag to deactivate the pick up game object when the player and a pick up collide. I then created a tag to the prefab "Pick Ups" called pick up and since its a prefab it was applied to all the pick up objects in the game. However since the unity physics don't allow the two object to overlap the player still bounced of the pick up objects, so I had to check the prefabs trigger option so that it acts as a trigger and allows the player to pass through and collect it.


     Moving on to the next tutorial I will be adding a ui to show the score, display text and end the game. First I reopened the player controller script and added a variable count. Then had it so that whenever an object was picked up it would add 1 to the previous count total. I then created a new ui from the hierarchy create section and selected text. I the switched the text colour to white so its easier to see and anchored it to the top left of the screen so it wasn't in the middle. I then went to player controller script again and added the new variable, however the slot to reference the ui under the controller script was not appearing.



What I Learned:

     I how to add triggers and how to essentially make a collectible game object. I also learned a bit on how to display text or a ui on the game screen.

What I'm Doing Next Day:

     Next day I'll be fixing the error i have currently run into and finishing up this tutorial that will display the score. I Expect to be finished with this tutorial in the next day or two and will be able to move onto the next project/tutorial.

Tuesday, September 15, 2015

Unity Day 4 (Roll a ball project)

What I Did Today:

     Today I followed the next tutorial which shows showing up the playing area. First i made a new blank game object named walls and reset its position. Then i made a cube and named it west wall and made it a child to the blank game object i made to help organize the project. I scaled the first wall to fit the edge of the ground and set its transform to rest perfectly on it. I then duplicated it, renamed it east wall and set its transform to fit the east side. I did this for the north and south side as well. Finishing off the tutorial I set the editor to local mode which allows you to see the transform move in play mode.



          With extra class time i decided to start the second tutorial. The next tutorial is adding the collectible objects. To start it off i created a new cube game object and renamed it pick up. Since the player game object was in the way i unchecked the box under transform deactivated it in the scene. The cube needs to attract the players attention so it was made half a unit cubed to make it smaller and appear like its floating above the ground, i also set all of its rotation axis to 45 degrees so its more eye catching. I then needed to make it rotate so i created a new script called rotator. To make it i had to code: "transform.Rotate (new Vector3 (15, 30, 45) * Time.deltaTime)" to make it rotate. After saving it and hitting play it does in fact rotate. I now have to make it into a prefab which will allow me to use the same object in any scene of the project and all changes to the prefab will effect all the prefab objects. I then dragged the pick up game object into the new folder i created turning it into a prefab. I then duplicated the prefab (in hierarchy) 12 times and positioned then around the middle of the ground almost like a clock. I then changed the pick ups colour by creating another material and making it yellow. I dragged it on to one of the prefabs then hit apply to apply it to all of them. Now all of them are yellow and rotate.


What I learned:

     I learned how to create prefabs and how they work, i also learned how to make an object rotate on its own.

What I'm Doing Next Day:

     Next day I will be making it so the pick up objects can be picked up.

Monday, September 14, 2015

Unity Day 3 (Roll a ball project)

What I Did:

     Attempted to fix an error with the current game version, where the ball (player) does not move. Error was solved the problem was when i set the speed setting under the player controller script to 10 last day it didn't save. After solving this minor error i moved on to moving the camera following the next tutorial "Moving the Camera". I started by tying it to the player game object. I started this by creating a new script and referencing the player object in the code by "public GameObject player;". Once i finished the simple coding that was required i had to drag the player object into the reference slot on the player code. The camera now follows the game object.



What I Learned:
   
     I learned to check to make sure changes on the unity engine save properly. I also learned how to make game objects child's to other game objects and how to reference other game objects.

What I'm Doing Next Day:

     Next day I will be making the playing area and the pick up objects for the player.

Friday, September 11, 2015

Unity Day 2 (Roll a ball project)

What I Did:

     Today I added physics to the player following the next tutorial on the Unity site. I started off by selecting the player object and adding the rigidbody physic by selecting components under the inspector then rigidbody. I then added a new C# script by selecting create on the project menu and then new script. I then started off by adding code to the new script.




What I Learned:

     I learned how to add some physics to game objects and how to add new scripts to them. I also learned a minor amount of C# coding which is used with the unity game engine.

What I'm Doing Next Class:

     Next day i will be adjusting the camera to follow the player and have it turn as needed.

   

Thursday, September 10, 2015

Unity Day 1 (Roll a ball project)

What I Did:
   
     This class i created a new 3D project called role a ball. I followed the first part of the tutorial (after the introduction part) on unity3d.com called getting started.  To start it off I created a plane as my ground, then under the scenes gizmos section I turned the grid off. I changed the scale of the ground by changing the x and z axis from 1 to 2 the y value will typically be 1 in unity. I created a sphere as the player and adjusted the y value from 1 to .5 so that it rests just above the ground. I adjusted the lighting of the scene to make it easier, finishing the first part of the tutorial.

What I Learned:
    
     I learned how to add new 3D objects into unity and how to reset their positions to the center. I also learned how to add new folders and materials to my assets folder. Along with that i learned how to create and add basic textures to my projects.

What I'm Doing Next Class:

     Next class i will be learning how to move my player or make it movable in game and will be adding my first bits of code.