This is a car game, with a view from above, like the old “MicroMachines”.
This application is the most fun. It uses the graphic capabilities of A2Z, especially the double buffering.
- Right and Left arrow : direction
- A : accelerator / Q : brake and reverse gear
- F12 : exit
Unfortunately, because of the slow speed of the CPU( 12.5MHz), the viewing window is only 320x240 pixels.
The field is created with a concept of “tiles”. Graphic tiles and obstacles tiles are not the same size: graphic tiles are 128x128 pixels, and obstacle tiles are 64x64 pixels. And the whole field (circuit) is made with tile matrix, which are 2D tables : 40x40 for graphics, and 80x80 for obstacles.
Obstacles Matrix on paper:
Obstacles tiles coding:
I have coded a program on my PC, in C language, that generates all the data needed to the game : graphics, and tiles matrix. The 2 tiles matrix are extracted from 2 .csv files, and the graphics are extracted from a single bmp file.
The process of creating a circuit is quite long; therefore, I only took time to create one circuit.
I found that collision management was difficult to code. I use the 4 corners of the vehicle. For each corner, the collision detection determines to which obstacle tile it belongs, and then check if it collides with an obstacle of the tile or not.
I am happy with this result. It is the final result of the A2Z project, and the last thing that I have developed.