Monday, December 14, 2015

Week 11 - The turret lives !


This week I was mainly putting my game together which is going well and I should be able to finish the game before the deadline.Update :- this blog was not posted in week 11 by accident  also i could not reach the deadline and was thus given an extension over the weekend

This week I took the image originally given to use by the tutor and photo shopped all the torrents out by placing patches of grass and snow into them after which I placed resized cubes that will later act as platforms for the torrents to be placed on.

As usual I started over thinking on how to make the torrent and made a huge mess of code   that didn’t even rotate thus I was going to ask my tutor for help but before i could ask we were given a simpler way to do it by using  using the 2d overlap circle which is basically making a radius in world space .To put it in the most simple way its like creating a sphere collider and detecting if something is inside the trigger or not. It is to be noted that you can use 3d version of it. To learn more about it you can check the bibliography below.







Bibliography: -

Physics overlap circle.

http://docs.unity3d.com/ScriptReference/Physics2D.OverlapCircle.html

Week12 - Rushing through the project !

This week I was mainly putting my game together which is going well and I should be able to finish the game before the deadline.
Update :-our course coordinator gave us an extension .

This week I took the image originally given to use by the tutor and photo shopped all the torrents out by placing patches of grass and snow into them after which I placed resized cubes that will later act as platforms for the torrents to be placed on.

As usual I started overthinking on how to make the torrent and made a huge mess of code   that didn’t even rotate thus I was going to ask my tutor for help with it but turns out there was a simpler way of making a torrent which was using the 2d overlap circle which is basically making a radius in world space .To put it in the most simple way its like creating a sphere collider and detecting if something is inside the trigger or not. It is to be noted that you can use 3d version of it. To learn more about it you can check the bibliography below. After a while I ended up using the 2d version of it called the 3doverlap sphere, which takes the z axis into consideration as my game was made in 3D and needed to take the Z axis into consideration.




The layer mask here should be public and should be enemy so the tower will not attack anything with other layers ex – UI / water layers .As a further condition check I check if time.time > textFire , this is to emulate a break between firing two shots and I the second if there is a tag check against the array if any of them are tagged enemy . An interesting thing about using physics overlap sphere is that it returns an array of colliders.

After working on the tower code I decided to add an extra feature of a second player that can be used if the player clicks on the switch button, this was achieved with ease as all you would have to do is  Boolean check to see if one is active then to set the other one false .



Bibliography: -

Physics overlap circle.


Physics overlap sphere

 http://docs.unity3d.com/ScriptReference/Physics.OverlapSphere.html

Monday, November 30, 2015

Week 10 -raycasting and a health bar !

For this week we learnt about how to use ray casting which as the name indicates is simply a ray being cast against all the colliders within the scene.

Although I initially found using ray casting slightly challenging reading up on the unity documentation helped and thus I am referencing them below although I have to find a way to use it in my current project, maybe to place the torrents? (Unity, n.d.).

While working on the game itself I found it difficult to make a health bar thus I asked for help to one of my peers who recommended that I use a tutorial video on how to create a health bar in unity using the UI canvas and a few colors.

In order the make the health bar you would first need to create a canvas and change its render mode to world space in order to resize it and make it small enough to only hold the health bar after which you can add a green colored image to it looks like a health bar, in order to give mine a more realistic feel I first added a black background then resized two colored images to fit inside it.














In order to show that the health is decreasing you will need to make a script to change its scale so It would appear as the health was decreasing .The code is very simple thus I am only placing a screenshot of it .(XOctoManx/Youtube, 2015)




























References
Unity. (n.d.). Unity - Scripting API:. Retrieved from http://docs.unity3d.com/ScriptReference/Physics.Raycast.html

XOctoManx/Youtube. (2015, May 2). Unity 5 Tutorial: Easy Health Bar C# - using localScale [Video file]. Retrieved from https://www.youtube.com/watch?v=87R0PziLDJ0&app=desktop