well I taught myself how to code in java and c# by watching youtube videos.
When I was in 7th grade in 1996 I taught myself how to program in basic
Basic is pretty simple
you got
do
loop
basically it causes the program to go in a circle
in between the loop you program conditions
if x then y
if b then a
if this particular thing happens then that particular thing happens
you keep track of information with variable, strings, and arrays
A string is a text type of information.
a variable is a numerical type information or a true/false type of information
arrays is basically like a string or variable but in series form. Dog[a] Dog[c] Dog[d]
That is the majority of programming.
The main difference in Basic and other languages like Java or C or C# is you don't type out as much stuff.
instead of typing if x then y
you type if (x = example){ y = example }
or
if (x= example)
{
y = example
}
in this case your making an if then statement. You include the condition in the parentheses, and then the course action in the brackets.
now you have to think of programs in functions
all a function is, is a box in which something happens to a variable.
a component is basically the same thing. You drag a script onto an object and it makes that object perform the task in the box.
Here is a simple program you can make for your game. all it does is rotate a box
// Means its there for explaination and doesnt do anything.
//rotateslow
var RotateDirSpeedx : float;
var rotatedirspeedy : float;
var rotatedirspeedz : float;
// at the beginning of a program we declare variables. These variables are floating variables. All that means is they use decimals instead of integers. you get to name the variables whatever you want. In this case I named it because rotation direction speed axis.
function Update () {
transform.Rotate(rotatedirspeedx,rotatedirspeedy,rotatedirspeedz);
}
//this is an update function. So every frame there is an update. All that happens during the update is the object is rotated. The amount that it is rotated is determined by the variable that you set. So in the case of 3d objects. They all have an x,y,and z axis. Real simple
here is simpler program in basic
do
print "hello world"
loop
pretty simple
of course there are mind bending puzzles to solve.
This is the video I started with