Unity has some framing that is custom but lets you use 1 of 2 languages for scripting, one of which is c#.
Posted: Sun Nov 06, 2016 8:09 pm
by Clumsy
/in as student!
Posted: Mon Nov 07, 2016 2:11 am
by Majiffy
I'd be interested in learning the C's, not Java though.
Posted: Mon Nov 07, 2016 1:17 pm
by Flubbernugget
They're close enough to the same thing if you're beginning
Posted: Tue Nov 08, 2016 7:32 am
by theplague42
Ah unfortunately none of my experience is with Unity; I'm web.
Posted: Tue Nov 08, 2016 7:32 am
by GuyInFreezer
/in student
Posted: Thu Nov 10, 2016 2:03 pm
by Cheetory6
If you’ve completed the lesson, feel free to copy and paste your code in a post here or to screenshot the results of your code running. If you feel like experimenting and do anything neat, please share that too. And obviously if you have any questions just shout em out and we’ll do our best to help.
If there’s anything in the format/presentation/or really any aspect of these lessons that you think could be better/improved that would also be greatly appreciated as we’re still pretty new to this kind of stuff! [or at least I am zzz]
We're starting up a discord if people want to hang out while working on things or if you just would prefer to ask questions in real time there we figured it might be easier for some! Ask myself, chamber or errant for linkage if you're interested!
Happy coding.
Posted: Thu Nov 10, 2016 2:14 pm
by gigabyteTroubadour
oh, i think my post was moved to the other thread but I /outed for this
sorry guys!! (tho if you're going to post lessons in thread i might follow along for future reference)
Posted: Thu Nov 10, 2016 3:24 pm
by Accountant
/in student
Posted: Thu Nov 10, 2016 4:01 pm
by GuyInFreezer
Posted: Thu Nov 10, 2016 4:47 pm
by xRECKONERx
I think it'd be helpful to understand what we're coding. Like, what is the "Debug" command? Etc
Posted: Thu Nov 10, 2016 4:49 pm
by Cheetory6
We're mostly aiming to just get the result with the first lesson and to go into detail on exactly what the code is doing as we go more in-depth with coding in general in future lessons.
I think it'd be helpful to understand what we're coding. Like, what is the "Debug" command? Etc
We do intend to teach everything that's going on in this example eventually. But Everything is a lot. We wanted there to be some sense of accomplishment rather than here's 6 hours of us truly explaining everything you need to learn before you can do anything.
Expect it to be peppered into future lessons when knowing more about it becomes more useful.
In this instance, the Debug command is used to help debug your code, when you run into issues it can be useful to write things to the console about the state of the program so you can better figure out where and why it's failing.
Posted: Thu Nov 10, 2016 4:52 pm
by xRECKONERx
so Log is what tells it to print to console?
Posted: Thu Nov 10, 2016 4:52 pm
by chamber
Yes.
There is a very deep rabbit hole to better explain what's going on. For now trust that we will get there in time, and that this lesson was mostly about getting you comfortable working in unity a little bit.
Posted: Thu Nov 10, 2016 4:56 pm
by Sudo_Nym
This was fun, though a bit simple. Here's my code for SendMessage:
Spoiler:
using UnityEngine;
using System.Collections;
public class SendMessage : MonoBehaviour {
// Use this for initialization
void Start () {
Debug.Log("Hello World!");
Debug.Log(@"Please enjoy the following poem:
A hobo always goes and goes
He does not stop to change his clothes
He rides the rail that he has chose.
Water pours out from a hose!
Do not show me tramp or bum
Tramp may ride, and bum's a chum
But both beg from the other one
Kids, stop chewing bubble gum!
Neither works like hobo does
Carving coin and twisting fuzz
Into a pretty pair of gloves
The past tense of 'to be' is 'was'!
A hobo, he will never steal
Unless it is to get a meal
Or cash, or gems, or fur of seal
Some Japanese eat broiled eel!
But saddest: those who will not ride
At all, but stand and die inside
As world spins on and throws aside
The past, and hope, and faith, and pride
In one direction trains do glide
Not looking back, on windward side
Across the continent's divide
The hobo rides and rides and rides
I'll eat anything that's fried
--Mindbender Steve, The Appeal to Reason, 1916");
Debug.Log("Thank you.");
}
// Update is called once per frame
void Update () {
}
}
Posted: Fri Nov 11, 2016 4:52 pm
by Equinox
Posted: Sat Nov 12, 2016 4:39 am
by Sotty7
Times I thought I would be a little overwhelmed but the instructions were done well so I didn't get lost. A nice intro to it all I think.
Posted: Sun Nov 13, 2016 5:15 pm
by Errantparabola
Hi! personal issues have kept me from being able to keep up to date on this, but those have largely passed so I should be fully engaged in 2-3 days. thanks and apologies.
Posted: Thu Nov 17, 2016 10:23 am
by Firebringer
/in student
working on first week assignment now
Posted: Thu Nov 17, 2016 12:32 pm
by chamber
Spoiler: Introduction
In the previous lesson we used the following code:
In today's first lesson we will be covering one part of this in more detail. "Hello world!". If you were observant you may have found it strange that we had to put quotation marks around this, but not other parts of the code. This is because "Hello world!" represents a string value. This shouldn't mean anything to you yet if you are new to programming, so don't worry. For today's lesson I've provided code snippets for most of the examples, however I encourage you to type them yourself rather than copy-pasting them. This will help your familiarity going forward.
Spoiler: 2.01: Variables explained
Variables are a means of storing data for later use. They are one of the core pillars of programming. It may help you to think of a variable as a box.
It has a name used to access the value, and the value that is stored. Variables come in different types, today we'll be handling 3 families of variables. Words, Numbers, and True/False (in programming called a Boolean). With the exception of Booleans, these are not typically grouped like this, and are only being done so now as a teaching tool. For Words your primary type of variable is a string. A string holds whatever characters you want it to, and is enclosed in ""s. An addition type is char, which is a single character. char's are enclosed in ''s.
If we go back to the program we made last week, we now know some of what we need to make a change.
This has several parts which I will now break down.
'string': This is the type of the variable we wish to declare.
'message': This is the name of the variable we wish to declare, we can then use it in the future to represent the stored value.
'=': This is the assignment operator. This may be confusing for people with a math background. Thinking of it as a traditional equals sign can get you in trouble. It means set the value of what's on it's left side to the value of what is on it's right side.
'"Hello world!"': This is the value we assign to message using '=' the assignment operator.
At this point I encourage you to play around a bit, entering your own string values.
Above we declared and assigned the variable in the same line. This is common, but not the only way to do things. You may not know the value a variable will have at the time it's being declared. In such cases you can break it up
Note that string is not repeated at the beginning of future references to message, only when it's first declared, and that you need to end each line with ";" the line terminator. If you are observant you'll notice that this isn't true of all code by looking at other parts in this file, but for now, everything you do inside of 'Start' will require it.
Try one final example to help understand variable assignment
At this point if you feel you don't understand variable assignment, please ask one of the teachers in discord.
That will cover strings for now, but as I said above, we are also covering Numbers, and booleans.
Spoiler: 2.02: More Types
There is a lot more going on with types for numbers than there were for strings and chars, and we wont be covering it exhaustively today. Primarily they are divided in 3 ways. First, whether the Number is an integer or a floating point (real). Second, the maximum and minimum sized number it can hold. And Third, whether it can hold negative values or not(signed).
The primary Type you will use for an interger is
int
. The primary type you will use for a floating point number is
double
.
An int is also known as an
int32
. This is because it can store 32 bits worth of data. It is signed, which means it can hold both negative and positive numbers. Because of this the maximum value it can hold is (2^31)-1 and the minimum value it can hold is -(2^31).
The first bit of the 32 being used to indicate whether it is odd or even.
A double holds 64 bits of data and is also signed. Because of the way a double stores data, it can store very large values, but is only precise to 15 or 16 digits.
Now lets try and use some new types of variables in our program.
The final variable Type we introduce in this lesson is a Boolean. A Boolean is either true or false. Up until now all of our programs have run from the top of 'Start' to the bottom of 'Start' in order. Boolean values are key in controlling and altering the flow of a program. We wont be doing so this lesson, but I wanted you to understand their significance.
Now that we have a basic grasp on variables, we are going to introduce and cover some basic operators. That sounds more scary than it is because we've already used one above +(addition). Some other operators are -(subtraction), *(multiplication), /(division), %(mod). For those that have been out of school for a while the % operator will return the remainder of a division operation. So 5%2 would be 1. These are collectively known as arithmetic operators. Most of those should work how you expect. However there is one big exception. / can have unexpected results for new programmers because if both sides of the operator are ints, the return value will also be an int. For example 5/2 would not be 2.5, it would be 2.
I don't have any structured exercises to take you through for these right now, but I suggest you play with them a bit on your own. When you are comfortable with them we can move on to some string operators.
The only string operation we are going to cover for now is concatenation. That's a big scary word, but it just means adding 2 or more strings together. When they are added the latter will be appended to the former. In c# the concatenation operator is also +.
You'll note that the 2nd string was appended (added to the end of) the first string. However, we are missing a space between them. I did this intentionally because its an easy error to make, and wanted you guys thinking about it.
Finally for booleans we are going to cover the comparative operator(==), not (!), or(||), and (&&). We will cover these in more detail later, but I at least want to get them introduced to you now. == is used to compare two values and resolves to a boolean. So for instance 1 == 1 would resolve to true.
2 Same as above but false instead of true.
3 Try concatenating a string and an int or double. Print it to the screen.
4 Try the same with a string and a bool.
5 print the product of any 2 numbers.
6 print the maximum value of an int.