Advertisement

Learning to code

Started by August 17, 2018 06:19 PM
1 comment, last by Scouting Ninja 6 years ago

Now, people tell me if I wanna make games, I.... GOTZ.... TO.... Know.... how.... to.... code!!!!!!!!! I went on YouTube and this guy had a 10 part tutorial each part is 20 minutes long. Now I know that will not cut it but I already followed his tutorials and all has been a success. From bools to deactivating GameObjects to press a key and you will get a debugger output. What else is there?

 

EDIT: Forgot to mention activating other scripts

You didn't mention what language you are learning?

 

3 hours ago, Timothy Sharp said:

rom bools to deactivating GameObjects to press a key and you will get a debugger output. What else is there?

First there is the 4 main data types: Bool, Int, Float and Strings. These are the core of programming. Also learn arrays.

After that you need to learn functions. These are short codes, for example a typical game function could look like this C#:


public PlayerTakeDamage (int AmountOfDamage){
  this.HealthPoints -= AmountOfDamage;
  //After taking damage see if player is still alive
  if (this.HealthPoints < 1)
  {
    this.IsAlive = false;
  }
  
}

You also need to learn classes, because these will allow you to make "objects" that can be used as data types or as structures for complex code.


public class Vector2D(){
 public float x = 0;
 public float y = 0;

	public Vector2D(float startX, float startY){
		self.x = startX;
		self.y = startY;
	}
}

//Now you can use the new class as a data type
Vector2D MyPosition = new Vector2D(10f,0.5f);

Then loops will be a good idea.


string Word = "Hello World";

void PrintEveryCharacter(string InText){
  foreach (char Character in InText){
    print(Character);
  }
}
//it will be used like this:
PrintEveryCharacter(Word);
//Ruturns H e l l o  w o r l d

 

After that you should know enough building blocks to start making a game.

This topic is closed to new replies.

Advertisement