Hello, today I am going to show you how to develop a computer game where character run continuously along a straight road collecting points and avoiding obstacles.
What are the things required while developing this type of game?
The game have a main character. We have to give a proper behavior.
- Character can jump left or right, jump over the obstacles, slide under obstacles.
- Character will die when hit the obstacles and so game will end.
- Character can collect points from the road by hitting them.
World is where we have everything in picture. The road, points, obstacles and main character. The obstacles are vehicles and hurdles. The main character have to jump over vehicles and slide under the hurdles. Or simply jump left or right. The road will have three lines. Where vehicles move towards main character.
If you look close to such games you will see the main character is not moving forward or backward. That is the magic. The other things are actually moving. Got it?
Getting in to the Picture
The objects are created and placed in the world continuously in equal time interval in different patterns. This includes points or coins and obstacles. If you look at any such game you will find this pattern and the same pattern can come more than once.
Each time interval a pattern generator create patterns and based on the pattern objects will be placed in the world. At first the pattern is created for obstacles. Secondly the pattern is created for coins or points. While generating the second pattern we have to consider the pattern of obstacles. Got it?
The reason we are doing this is simple. When coins are placed in the world, ten or less coins can be placed in the line in an interval. We place coins continuously one by one. Say if the next position is occupied by an obstacle, we can place coin over the obstacle if it is a vehicle or do like this for hurdles by placing coins under hurdles. You got the picture right?
Once we finalize the patterns for the current time interval we can use the pattern to place the objects in the world and they will move towards main character 🙂 . In these type of games pattern generation is important. Patterns must be created without continuously repetition. If we generate same pattern continuously, it will be boring. We can customize the patterns on demand by giving behaviors and look and feel.
Hope this tutorial gave you a small idea about running games 🙂