![]() |
|
API >> Tutorials >> Fly my robot, FLY!!!
OverviewYou 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 basesFor 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.
Platform BasesAs 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.
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:
As background, we set the follow image to the playfield:
About the design of the platform, we use the following example (DisplayPlatform.java):
Now take a look to the robot itself!
API >> Tutorials >> Fly my robot, FLY!!!
|