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.
[widgets_on_pages id=”udemy_advert_java_1″][widgets_on_pages id=”udemy_code_details”]
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’
spaceShip.shoot(alien);
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.
[widgets_on_pages id=”udemy_advert_java_3″][widgets_on_pages id=”udemy_code_details”]
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.
how do i transitions into another scene when the user clicks start ?
Hi Brandon,
Thanks for your comment. Could you give a bit more context? Platform, scene type, current code.
Hi John, I’ve just arrived at your site after a Google search for ‘java game beginner’. Looks like I’ve arrived at the right place. I have a very complicated app/game in mind but am a complete beginner with Java (although I have a little programming knowledge in Basic, VB8 and a flight simulator specialised language called SIOC). I’ll eventually want it to run on Adnroid devices, phones and tablets but for now I’m going to be using Windows to learn java. Thanks for the work you’ve put in to these tutorials – expect to be bothered quite often! Cheers, Roger.
HI Roger great to meet you. Bother all you like, it’s kind of why I made the site in the first place. Good luck with your app and be sure to share some details when you can.
Thanks for the comment.
Thanks John, already up to Part 7!
hi i am here just joined do you think anyone can code
Hi Liam,
Definitely anyone! It is not about intelligence or natural ability, just determination. Read some tutorials, do some projects, don’t give up and you will soon be making games.
Good luck!
John
Hey, Nice website! I wasn’t really looking for a Java tutorial but now that I know a little about it, can u tell me where to download the java Game platform.
Ps I am a total noob at Programming, I am just looking for a hobby.
Hi Mustafa,
Thanks for commenting. Exactly how to make games using Java depends on what type of games and platform you want to make it for. If you want to make games for Android using Java start here. If you are not sure start here.
Hi john…
gamecodeschool.com is awesome , specially every topic is focused from scratch which makes difference than other web-sites and tutorials.
we’ll love to go through more tutorials in future.
thank you.
Many thanks Dhruv.
John, can you please explain how to make the graphics
Hi there,
The first tutorial that deals with graphics is this one: http://gamecodeschool.com/android/drawing-graphics-demo/
Hi John! This tutorial was really helpful. I am waiting for Part 2.
Thanks Mazim. I will be as quick as possible.
Hey John, can you please tell me how to make sprites in java. In my e-mail inbox if you wish.
In Java/Android, try this tutorial:http://gamecodeschool.com/android/drawing-graphics-demo/
i meant for desktop applications not android
Unfortunately my tutorials don’t cover that. Sorry.
He John, been trying to learn coding to start making some good games. Thanks so much for this very good tutorial. Already learned more from 2 parts than i did 37% of the way through Java on Codecademy. Cheers. The fact that you give actual examples that could actually go in games helps me 10x more. Thanks again! -Brodi.
Oh, and P.s. Do you know how they would do random hits and stuff, for example, like Runescape?
Thanks again!
Hi Brody, thamks very much for your comment. Reallly nice to hear. If you give a bit more info about the feature you are interested in I will try and point you in the right direction.
Ok so lets say your trying to make a java game. All I know how to do at this point is some advance html stuff. I can make a website and I save it in folder named .html it opens in a web browser I don’t understand even after I make some kind of a java file do I also save that with my text editor as a .java file? I don’t understand how to get your java file to open? so confused sorry if this makes no since.
Hi Mike,
Good question. It varies depending on which platform you are writing the Java program for. On Android, you write all your code in the Android Studio application. You click a button and Android Studio will prepare your Java along with a bunch of other stuff (that Android Studio handles) and produce a file which Android devices can run. You can get started with this process here. As you learn more Java, you will be able to understand more advanced projects. This page is all Android projects starting at the bottom with the simplest one.
I hope this helps a bit.
I’m new to java game coding too. But your tutorials look like I can master them.
I want to create a game about space pirates. Hope this will help me!
Thanks, John!
Thanks for the message Thomas. Good luck.
Hi John How do I start Game programming although I have a basic knowlegde in java programming
I don’t know how I start and I always reading tutorials
Hi John,
You can be scientific about where and how to start based on current knowledge, type of game and other factors as well. To do so read this getting started guide. But if you just want to get started without any fuss then make sure your basic Java knowledve is reasonable reading this java series and then dive in to these Android projects.
I hope this helps a bit. Feel free to keep in touch.