The Cubes Have Eyes!

Day 23–11/23/20

Green invisible cube = guards eyeballs or field of view

It is crazy to think that it has only been a month since joining this program. I would have never thought how far I could come in just that short amount of time. It’s crazy to look back and think of the journey so far. I went from knowing absolutely zero programming, to now almost finishing my 2nd game! I still remember how overwhelmed I initially felt, and now I find that coming less frequently. I am starting to feel more and more comfortable with what to do in certain scenarios. There is a lot I need to learn still but it is cool to see the pieces come together.

Today, I was finally able to get a big chunk of work done. I had intended on finishing this project by the end of last week but due to preparing for a skills assessment, a lot of my time towards the end of the week went towards practicing challenges. Definitely not a waste though, I learned a lot while running through challenges with Mar and Ryan, and as I have mentioned in a previous post, it was a nice breath of fresh air to work with people, as this field is a lot of work on your own.

Regardless, back to today, I finished up my enemy AI, created a coin to distract the guards, and lastly added a few features to the security cameras.

For my enemies, I had to give them “vision” within the game, as they are essentially just blind objects walking on a scripted path. To do this is actually a very simple task, basically like almost everything else in this game we can use an invisible game object with collision attributes to create the guards’ field of view. Very cool and simple concept and I have a feeling this same technique could be used for sound detection as well.

The coin distraction is a cool little feature, and is actually very similar to something that I had done earlier in this project. The scripting of the coin toss used a lot of the same techniques of scripting my player movement. So to do this, I used a raycast in order to instantiate a coin at the location of the mouse click. This is only my 2nd time really using a raycast, so I still am fairly unfamiliar with it but the pieces are starting to make a lot more sense.

Anyway, the function of the coin is to create a distraction. Basically, when the coin is tossed, the guards will then move towards the coin. One thing, I would like to add to make it more realistic, would be a distance check. That way only guards within a certain range would be alerted to the coin. This should be a quick and easy task as it would just require putting an if statement within the foreach loop sending my guards to the coin.

Lastly, I worked on the security cameras and added a collision with the visual field and the player that ends the game and activates the game over cutscene, similar to the guards catching Darren.

So far this game has been really cool to work on, and it has really taught me how simple and useful an empty game object can be! I have now used empty invisible game objects to detect camera trigger points, audio queues, sight for the guards, and the cameras, and I am sure I’m forgetting something but the amount of information and things you can do with one simple tool are incredible.