Creating Simple Car games

by Manikantan

As a sequel to my previous post on Gaming Tutorial, I now show how to create a Simple car game whose working model/ code logic is same as the previous HELI game tutorial. The photo images will give you an idea or a reminiscence of what the old car, brick- based game looked like.
Brick game

However, in this post, I mainly concentrate how the logic of the Heli and this Brick game intersect. How close their code implementation is.

The GamePlay
In the classic Car brickgame, the user controls a car that can move only left or right. There are cars coming in the opposite direction, which with the user must not collide. The car driving towards us, moves only in the vertical axis.

Changes in the Code Logic.
So, essentially the game’s logic boils down to the same collision detection. The user’s car moves in Left- Right and hence we need to code Key-Listeners for that. ( or Modify the Key-Listener in previous example – from pressing on * to <Left> and <Right> ). Comparing to the walls or obstacles in the HELI game, we have cars like our own moving downwards. So, instead of decrementing the _X, here we need to increment the _Y for the opposing cars.
Otherwise, household management is the same. The randomization of the _x must be done once the opposing car reaches the bottom of the screen.

Improvements/ Optimizations

  • You have the liberty to move the opposing cars at different speeds, unlike the HELI game.
  • If you are rewriting the classic Brick-game, even look wise, then you can have a single square brick as graphic. Use this to build the car, by properly grouping them. This will greatly reduce the game-size.
  • Have scores and levels when you replicate the Brick-Game. The levels are essentially related to the speeds at which the cars travel.

If the performance is slow (which is unlikely), use bitmaps for the cars. The reason is the computation involved in vector graphics movement is high as compared to the near zero computation in the case of bitmaps.

So, there you go… You learnt how-to code one game and got one more as a reward 🙂

Related posts:

  1. Creating a simple game in FlashLite 2.0 In the following article, I describe how to create a...
  2. Programming Games with AI So far, I have talked about flash games based on...
  3. Getting Started with Flash Lite 1.1 Game Development I found this wonderful tutorial on how to get started...
  4. Games on Symbian – Scope and dimensions I have been doing a random literature survey on...
  5. Creating a customized Ticker Component in Flash Lite The Ticker is essentially a scrolling text that can be...

Related posts brought to you by Yet Another Related Posts Plugin.