This course is for you if you are completely new to programming or the Java language. This course will quickly cover everything you need to know to be building Java games as soon as possible. This course will be equally relevant to you regardless of where you intend to use your Java skills. As we will see there are lots of game related projects to accompany this course and you will be able to choose which ones are relevant to you. We will complete Java desktop games(compatible for Mac, Windows and Linux) as well as Android games in Java too.
This course will assume you know absolutely nothing about Java or any other programming language. It will explain all jargon as we proceed through the course.
At times in the course, we will take an optional break from theory to do an appropriate project. These projects are hands-on real coding and are much more fun than theory. All the projects will be as game related as possible, including some full working games.
When you have read the final level 1 tutorial (Part 10: Interfaces in Java games) you will be qualified to implement all the level 1 game projects for both desktop Java (Windows, Mac, and Linux) or Android’
Explaining code through comments
Sometimes I will add extra explanation or clarification within the code itself. To do this I will use Java comments. Whenever you see a line of code with two forward slashes at the start, that line of code doesn’t do anything except make a comment. In our Java programs, we will use comments to remind us of what different blocks or lines of code achieve. Here is what a comment looks like.
// I am just a comment and don't really do anything spaceShip.shoot(alien); // The line of code above shoots an alien // That was a useful comment wasn't it
Enough of all the introductions let’s get on with the tutorials.
The Java game coding tutorials
The tutorials are designed to get you coding games as fast as possible. They are not fully comprehensive and some topics have been trimmed to the maximum. I am sure that the best way of learning to code games; is to code games. So the sooner we can start doing that the better. You will find that all of the practical Java projects on this site come with loads of refresher information and of course lots of useful Java comments using “//”. So don’t feel you need to master a topic before moving on.
We will step by step, walk through the following topics and concepts.
1 – Game Variables in Java
This tutorial serves as an introduction to Java and explains how we keep track of the state of our game when writing in Java. Let’s get started and learn about data and game variables in Java.
2 – Changing Game Variables in Java
This tutorial shows us the mathematical way that we can manipulate our game’s data that is contained within our variables. Changing game variables in Java.
3 – Checking for conditions in our game
Now that we know how to use variables to represent all the important aspects of our gave we will see how we can test for important events called conditions within our game. Find out about Checking for conditions in our game.
4 – Branching our game code
Here we will use everything we learned about conditions and if statements and take it to the next level to finely control the order our code executes within our game . Learn about Branching our game code.
5 – Looping our game code
In game coding, we will regularly want to execute parts of our code multiple times while making subtle or not-so-subtle variations to our code on each pass. This is how: Looping our game code.
6 – Organizing our code with methods
As our game code grows in size and complexity we need smart ways to organize. Organizing our code with methods.
7 – Understanding OOP for coding Java games
Object Oriented Programming (OOP) is a vast topic. It would take multiple complete books to learn it all. However, the complexity and depth of OOP do not have to be a barrier to getting started coding games in Java. This whirlwind tour gives us the absolute basics we need to get started making games. We can then improve our OOP further while making actual games rather than pouring over textbooks. Read the tutorial Understanding OOP for coding Java games.
8 – Handling game data with Java arrays
Here we find out about how to handle multiple game entities using arrays. So we know we can build spaceships, aliens, bombs etc with our new OOP skills but what about if we need hundreds, even thousands of them? Read Handling game data with Java arrays.
9 – Managing simultaneous events with Threads
This is the second to last tutorial before you can make games for real for Android or your desktop OS. Like events that happen to us in life, our games do not run in isolation. They are part of a system. Threads give us the ability handle this apparent complexity with ease. Every game we write will have a thread. Find out about Managing simultaneous events with threads.
10 – Using Java Interfaces
We have made it! The final tutorial before you can take on your first real game project. Learn how to further reuse other people’s hard work with this special type of class. Read about Using Java Interfaces.