Monday, April 1, 2019

Week 28

Week 28:

Collectables and Scoring:


So, this week, I have been quite busy with my Ubiquitous Computing and Web-based Gaming Assignments. As such, I have gotten as much done as I would have liked. I have, however, managed to create a small system that enables that allows the Player to collect objects and records how many they have collected. I looked at a Youtube video by Jimmy Vegas for inspiration:


https://www.youtube.com/watch?v=D0lx90n0s-4

So, I began by creating new “Canvas” in Unity Engine. Then, I created a new object called “Text” and in the “Rect Transform”, I pressed “Alt-Shift” and then the “Top Left” option. Then in the “Pos X” and “Pos Y”, I entered “10” and “-10” respectively. Then I in the “Text Script”, I typed in “Pages 0/8” and in-game the Player will then have to collect 8 pages, which’ll then kill the enemy NPCs.


Additionally, I also changed the “Font Size” from “14” to “28” and then I set the “Horizontal Overflow” and “Vertical Overflow” options from “Truncate” to “Overflow”. I then changed the “Font Colour” to a greyish-white colour. After this, I then went into the “Script” folder and created a new C# Script, that I named “gameplayCanvas”. In the script, I then used the following coding:


In the “Canvas”, I then dragged the “Directional Light” onto it. After that, I also grabbed and dragged “Monster” onto the “Canvas”, and then changed the “Size” from “1” to “8” in reference to how many enemy NPCs will be wandering around the Map. I then set the total of “Pages” to “8” and dragged the “Text” to “Txt Pages”. Next, I now need to create the “Pages” themselves.


To do this, I went into “Game Object” and then “3D Object”, and then I selected the “Cube” object. For the first “Page”, I then changed the “Positions” for “X” to “-11.11”, “Y” to “0.67” and “Z” to “19.815” respectively. For the “Rotation”, I changed the “Y” to “180”. And finally, for the “Scales” I changed the “X” to “0.5”, “Y” to “0.6” and “Z” to “0.1” respectively. In the “Box Collider”, I then set the “Trigger” option and made the “Size” match the “Scale” I had set previously.


I then renamed the “Cube” to “lostPage” and then I gave it a “Add Tag” in the “Tag” settings. Then, I pressed “+” and then named it also “lostPage”. In the “Tag” settings, I then set it to “lostPage”. This’ll allow all of the tags to have the same function as each other and when the Player collects a page, the game will notify them as such. In the “Player” script, I also added the following.





No comments:

Post a Comment

Week 34

Week 34: Critical Reflection: Conclusion: Over the course of this college year, I have managed to design, create and test my Horror-ba...