
So you want to learn a new programming language, improve upon on or want to work in a more constructive way. What do you do? How do you begin?
Most projects fail due to lack of foresight and design, they skip out of the design phase a little too quickly, for large projects to even small ones design can be a load of help.
Without structure, program code can be messy, hard to read by another, difficult to adapt to a new environment or hard to debug, trying to find the error in a long code file is like looking for a needle in a haystack.
Here is a short list of common data types found in coding languages (Java, C, C++ etc).
- int, or integer is a number variable. It can only hold a certain ammount of numbers. It can not do decimal values like 3.142.
- double, is the same as an int value but can store a lot more information, roughly double, and so the name….double.
- float, this variable type can store decimal numbers, or floating number as some people will call them.
- string, a list of characters, can be numbers 1,2,3,4~9,0 or letters a~z, capital letters A~Z or special characters !,”,£,$ and so on
- char, a single char is a single character “£” for example
Believe it or not, most things in code can be carried within those types, names, addresses, telephone numbers. The main problem is where to use them, in what way, how they will transfer data, can they transfer data, how visible they are to other parts of the code. This may sound daunting at first, but it is something you must learn, for any application and that includes making games.
I will started with some basic Java, as it is one of the most easy to get into languages about really.
First off, you need the JDK or Java Developement Kit, this can be downloaded Here
As sadly there is so many variations of operating system you could be using, I can not go through them all now but I will make some guides in the near future for the most common ones (linux, windows and mac).
For now I shall so you how to set a path in windows in command prompt to enable the Java compiler or “Javac” to be used.
First find out where Java has been installed. Generally it will be in your C drive or your main installation drive.
C:\Program Files\Java\jdk1.6.0_11\bin
Is where I found my javac application
Now open a command console (command prompt or DOS) and type the following
set PATH=%PATH%;C:\Program Files\Java\jdk1.6.0_11\bin
Naturally change the “C:\Program Files\Java\jdk1.6.0_11\bin” part to where your JDK is installed.
Okay dokey, now we should have the java compiler installed and happy.
Next up is making your first program in java.
Open notepad, (word pad or office word are both unsuitable for coding in java, as they handle things a little bit more complex then how notepad … does)
and type the following
class hellotoyouworld {
// this tells the computer, the class name hellotoyouworld is what the computer will call the complied code
public static void main(String[] args){
// this is basic gibberish that tells the computer how to handle the code, we will cover this part in a lot more depth later
System.out.println("Hello to you mr world");
// this tells the computer to output a new line of text with the words "Hello to you mr world" in the command line
}
}
// the { and the } tell the computer the beginning and end of things
or if your lazy, copy and paste this into notepad
class hellotoyouworld {
public static void main(String[] args) {
System.out.println("Hello to you mr world");
}
}
Now the important part of compiling, save the notepad file as “hellotoyouworld.java” ( ya can ignore the “’s)
Save it somewhere you can easily get to in command line, go to that place now in command prompt / dos.
cd c:/wherever/folderofdoom/moo/
cd means change directory, where you are in other words.
then type
javac hellotoyouworld.java
Hopefully it will compile, if it does then it will have made a .class file, you can make this run by typing
java hellotoyouworld
will make the program run, you don’t need to put .class or .java after it, it will run it naturally.
If it does not compile, make sure there is } to end the initial {’s and make sure the right letters are capitals. If you still can’t get it to compile, then send me an email and I will try my best to help you.







Alan Hamlyn on 16 December, 2008
Absolutley right about design phase, the downfall of any project in any language.
Bill Nunney on 17 December, 2008
Planning is important definitely. ATM i dont plan very efficiently because i’m still relatively new to AS3 (just over a year).
Good tutorial, hope to see many more!