Saturday, 25 October 2014

Coding a Lightswitch


We first came into the lesson to be told that we had to open a document up in-titled "Light switch". We were completely unaware of what we were going to do at this stage, that was until Ewan sat us down and told us we were going to make a light switch turn off and on.

This was the area of Computer Games Arts that I was trying to avoid. I had no idea how this worked but was keen to start learning. We had to open up Unity and get to this page:

Basic script for turning a light on and off.

As you can see from the image, it is very complicated. I'm still trying to understand how by putting in a bunch of words into a computer, that programs a light switch to turn off and on. We created a box around the light switch which meant that if the character in the game was to enter the box, then they could turn the switch on, otherwise they could be across the map and turn it on.

I think that this task was extremely difficult, but I am willing to learn how to do it. Although it was really hard, I think it was a great skill to learn, I think that if I focus my efforts towards Unity a little bit more then I could end up with a great end result.


The reason why the button will not turn in the video after I had walked away from the switch was because the switch had a box surrounding it. I had coded it in the lesson, so if you enter the box, it will allow you to turn the light on, this means that you cant turn the switch on from the other side of the map.

No comments:

Post a Comment