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


No comments:
Post a Comment