c++/allegro 5 maze type game

749 Views Asked by At

using C++ and allegro 5,

I'm doing a maze-type game and wanted to find out the best way of creating the maze ?? is it simply a case of putting down a bunch of rectangles/squares ??

How would you do collision detection once you have a maze (stop player from passing through walls) ??

i'm o.k with bounding box collision detection between 2 objects but i cant think of what to do with a whole maze. (note, i've just recently started learning allegro)

any advice appreciated.

1

There are 1 best solutions below

0
On

I am new at this as well, but creating a bitmap inside allegro and then drawing your maze to the bitmap.

ALLEGRO_BITMAP *maze = NULL;
al_set_target_bitmap(maze);
al_draw_filled_square(x,y,x,y);
al_draw_filled_rectangle(x,y,x,y);

since you change target to maze, all the drawing done after will be in the maze bitmap.

then you can just draw maze to the screen and it will have all your squares and rectangles in it. just reset you target to the display after drawing you maze.

al_set_target_bitmap(al_get_backbuffer(display));