The Java Game Framework.

Examples, tutorials, documentation and download of the Genuts Framework.
Games made with the Genuts Frameworks.
General articles around games.
Links covering all needs around game dev.
Who are we?
Terms of Service

API >> Tutorials >> Fly my robot, FLY!!!

Overview

You wake up this morning with a marvelous idea: an ActionPlatform game with a robot!
It will be able to walk and to fly, the platform will be composed with different types of elements. But know the question is: how can you make this game?

In this tutorial, we will see:

But we will start with some bases.

Collision bases

For the collisions, we will use the pre-collision mode, of course, it is possible to use other methods, but this is the easiest. If you don't know what we are talking about, don't worry, you should refer to Playfield Scrolling and Pre-Collision mode tutorial.

The only interest of our robot will be its displacement, it doesn't have to know if it is in collision with something or not, it will only try move all the time.
The responsibility for collisions checking is given to the tiles. In that way, we will be able to add or to remove types of tiles without changing the code of the robot.

Platform Bases

As seen in Tiles for games tutorial, we will construct our platform with our simple engine. At the end of the tutorial, we will use different types of tiles. But now, to start, we use only one type: Ground tile.

Ground tile

When the robot will encounter a ground tile, it will stop moving. For this, we only have to forbid the displacement of the robot for any collisions. In class GroundTile.java we override the method preCollisionWith(Sprite) like that:


...
  protected boolean preCollisionWith(Sprite s) {
    return false;
  }
...

As background, we set the follow image to the playfield:

Background image of the playfield

About the design of the platform, we use the following example (DisplayPlatform.java):

Now take a look to the robot itself!

  Next Page >>

API >> Tutorials >> Fly my robot, FLY!!!