Solo coding lesson

In today’s lesson, I was set off on the task of working out the answers to four questions about coding.

What does the dot do in a piece of code?

The dot is used to specify smaller and finer details, for example

What are the curly brackets used for?

They are used to contain a specific section of code.

Which is better, Allman or 1 TBS?

In my opinion, 1 TBS indents are better because they seem more logical to me, but overall it doesn’t matter because the code runs exactly the same regardless.

1tbs and allman comparison.png

Why does code have tabs in?

The tabs are used to indent the lines of code, purely to make it easier to read. They are also useful to show levels of brackets, but overall they are just a cosmetic thing to make it look good.


I was then set off on the task of making some code, that would make a cube or model interactive. I tried task 4, which was to make the cube spin across the x axis when you press down the space bar. I started off with some code that made the cube spin around the y axis automatically, and then added in code borrowed from when I made a flashlight but changed it so that it would be the space bar. I was struggling to make it work, because it wouldn’t keep spinning, it just only moved in tiny rotation movements everytime you pressed the space bar. I got stuck and sought help from Unity’s coding help website, and managed to work out a way to get it to work using booleans.

SPace rotate boolean vers.

I then adapted this to make it work without the help of booleans, and it shortened down my code a bit, but still worked effectively.

Space rotate no bool vers.

Spin thing lalal



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s