It’s been an unbelievably long time since I wrote or did anything. A lot of things happened in my life lately which kept me away from blogging but my desire to make a game just got bigger.
As most of you noticed, I focused a lot on the libgdx library and even that went through a lot of changes. It recently hit version 1.0 which is amazing news, so go get it while it’s hot. This also means more stability, consistency and the things that are written for it are likely to stay the same and not change. My libgdx related entries need a good refresh and I am pondering if is it worth the effort or I should just migrate everything to the latest version and carry on with Star Assault editing the existing posts with a reference to the new setup and changes.
This is the fourth part of the libgdx tutorial in which we create a 2d platformer prototype modeled after Star Guard.
You can read up on the previous articles if you are interested in how we got here.
Following the tutorial so far we managed to have a tiny world consisting of some blocks, our hero called Bob who can move around in a nice way but the problem is, he doesn’t have any interaction with the world. If we switch the tile rendering back we would see Bob happily walking and jumping around without the blocks impending him. All the blocks get ignored. This happens because we never check if Bob actually collides with the blocks.
Collision detection is nothing more than detecting when two or more objects collide. In our case we need to detect when Bob collides with the blocks. What exactly is being checked is if Bob’s bounding box intersects with the bounding boxes of their respective blocks. In case it does, we have detected a collision. We take note of the objects (Bob and the block(s)) and act accordingly. In our case we need to stop Bob from advancing, falling or jumping, depending with which side of the block Bob collided with.
Getting Started in Android Game Development with libgdx – Tutorial Part 3 – Jumping, Gravity and improved movement
This is the third part in the Building a Game with LibGdx series. Make sure you read the previous articles to build a context for this one.
In the previous article we have animated Bob’s movement, but the movement is quite robotic. In this article I’ll try to make Bob jump and also move in a more natural way. I will achieve this by using a little physics. I will also clean up the code a little and fix some issues that crept into the code in the previous articles.
This is the second part of the Building a Game with LibGdx series. Make sure you read the first part before starting on the second.
There will be a lot of stuff covered in the following articles so I will try to break them down in more digestible sizes.
We left off with a basic world and Bob gliding back on forth when using the arrow keys or touching the screen.
It’s been almost a year since the last post and I don’t really know where the time did go to be honest.
The good news is, that I am planning to add some new material pretty soon.
My focus will be on more libGdx and game theory which will be framework agnostic. I will try to work closely with folks who make learning really easy and will work out a nice roadmap that is achievable with my shrinking free time to provide quality material to share my findings and hopefully one can benefit from.
Getting Started in Android Game Development with libgdx – Create a Working Prototype in a Day – Tutorial Part 1
In this article I will take a detour from the building blocks of a game engine and components and I will demonstrate how to prototype a game quickly using the libgdx library.
What you will learn:
- Create a very simple 2D shooter platformer game.
- What a complete game architecture looks like.
- How to use 2D Graphics with OpenGL without knowing anything about OpenGL.
- What different entities make up a game and how they are tied together in a game world.
- How to add sound to your game.
- How to build your game on the desktop and deploy in onto Android – yes, it’s that magic.
One useful architecture pattern in game development is the MVC (model-view-controller) pattern.
It helps separate the input logic, the game logic and the UI (rendering). The usefulness is quickly noticeable in the early stages of any game development project because it allows to change things quickly without too much rework of code in all layers of the application.
Adding depth to our games, then we have to get ready to go 3D. 3D is not complicated at all and rendering 3D graphics is quite easy using OpenGL ES.
I will break the concepts down to the basics. In a 3D game, as in the real world, everything happens in space. If we were watching a football match from the tribunes, looking down onto the pitch, we would be observing the unfolding action from a perspective. What we would see is defined by the field of view and the players that we “catch” with our eye. We would look at a 3D scene.
In this part I will try to explain how to design easily extensible and maintainable game elements that control their own internal state and behaviours.
An internal state is best described as being the soul and mind of the entity. In the first part I described why composition is better than inheritance. In a nutshell composition provides the means to interchange the algorithms associated with their behaviours. State on the other hand helps objects to control their own behaviours.
In the previous two articles (article 1 and article 2) I have tried to introduce OpenGL ES on android. Now let’s take it further and build on them. In this article we will create a billboard (which is a square) and we will apply a texture onto it. A texture is nothing more than a bitmap image. When we work in 2D we set the Z coordinate to 0. We’ll cover 3D later. This is very useful to use in 2D games and is the preferred way to display images using OpenGL. It is very fast indeed.