That is the question.
This was the task we had to do for the day;
- What does a dot . actually do?
- What are curly brackets for?
- Which is better, Allman or 1TBS?
- Why does code have tabs in?
- The dot syntax is for showing something belongs to something else, like an extension of. When you make a command, the dot opens up the next chain of possible follow on commands.
- They denote program source code. All of the code you’ll write will appear within these brackets.
- Pretty much up for debate to your own personal preferences but in my opinion, 1TBS is. One True Brace Style where all statements have opening and closing braces with their corresponding code. Allman forces vertical spacing by placing braces on their own lines making the code longer. (Ask a certain someone around the course about Allman though and he’ll tell you it offends his eyes).
- Pretty much to keep the placement of the entire scripts and code tidy and to make it easier to read and find whatever it is you’re looking for.
I have literally no idea what this piece of code is talking about.
Running along beside this and for those of us who still don’t get this, we were given a piece of code and sent away to experiment with it.
At this point I’d GIF and show you what I’d done, made a box fly off the screen in various directions. Not amazing I know but this is me we’re on about. Trouble is, when i loaded up Unity to GIF it, I got a whole bunch of errors that Unity said was in the script. Taking out what it said shouldn’t be there resulted in another set of errors straight afterwards that said they should be there.
I’ve somehow managed to replace the code Ant gave us to mess around with with something else entirely which is why my cube is doing, things.
I’d love to tell you exactly how I got these to happen but I’d be lying.
This is what’s supposed to be there and what I’ve replaced, also it’s what I was altering to make that block fly.
So after these class shenanigans, Ant posed a challenge to us. We have to create a sphere and attach code to it, any code we like and the entire class will do the same. Next lesson, all these balls we’ve created will be put into one big file/arena and there’ll be a Ball-Rumble (see what I did there?) to decide the winner. Either that or there’ll be that many different effects and pieces of code put on these things all fighting for supremacy that it’ll crash Unity completely.
Either or, I’m screwed.