Java game coding tutorials
Java Game Coding Level 1
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 […]
Game variables
When we code a computer game, the first thing we need it to do is to ‘know’ what the current state of the game is. This might include the player’s score, how many enemy space ships there are, where on the screen all the game objects are and what they are doing. The game’s variables are the part of […]
Changing the value of game variables
The main way to change our game’s variables using Java is using a concept called operators.Operators in Java are just like mathematical operators and many of them are the same symbol. So if you coped with junior school math you will have no problem with this tutorial. We will start by looking at a list […]
Checking for conditions in our game
In order for our game to dynamically respond to the player’s input, conform to the game’s rules and control the artificial intelligence of characters within the game; our code will need to make decisions. Programming languages achieve this by creating and testing for conditions based upon, the values held by our variables.
We want to be […]
Branching our game code
We have seen in the last tutorial how we can detect certain conditions in our code. For example when the player loses a life, destroys an alien or gets a new fastest time. We have also seen the Java keyword that allows us to execute a certain block of code when a certain condition […]
Looping our game code
So, what do loops have to do with programming? They are a way of repeating the same part of the code more than once. We can loop over code although potentially for a different outcome each time. This can simply mean doing the same thing until the code being looped over prompts the loop to end or it could […]
Organizing our game code with methods
Methods allow to organize and compartmentalize our code. As our game projects become more and more advanced with exiting features and deep systems then methods will be one of the programming tools that will make this manageable.
So what exactly are Java methods? A method is a collection of variables, expressions and control flow […]
Understanding OOP for coding Java games
Object Oriented Programming OOP, is the way almost all programming is done, in almost all languages. It hasn’t been this way forever and there are some exceptions but if we are serious about building games for any platform we need an introduction to get us started. OOP also holds the key to organizing and managing […]
Handling game data with Java arrays
All these objects and variables are useful but what happens when we have hundreds or thousands of them? How can we possibly keep track? Java arrays are the solution and in this quick tutorial, we will see the simple way that we can organize objects and variables into arrays.
To get started look at […]
Managing simultaneous events with Threads
So what is a thread? You can think of threads in Java programming in the same way you do threads in a story. In one thread of a story, we have the primary character battling the enemy on the front-line while in another thread the soldier’s family are getting by, day to day. Of course, […]