Hello !
I want to make a maze game and i follow the tutoriel from LazyFoo to make it i want to test collision detection but my code is different form the tutorial i don’t know how to handle the collision box of each wall .
This is my code:
I have a class for the wall:
Wall::wall()
{
//Set the collision box
mBox.x = 0;
mBox.y = 0;
mBox.w = MUR_WIDTH;
mBox.h = MUR_HEIGHT;
}
I declared a map in my main.cpp
int map[NB_BLOCS_LARGEUR][NB_BLOCS_HAUTEUR]={{0}};
But in the tutorial it’s like this:
//The level tiles
Tile* tileSet[ TOTAL_TILES ];
//If the dot went too far to the left or right or touched a wall
if( ( mBox.x < 0 ) || ( mBox.x + DOT_WIDTH > LEVEL_WIDTH ) || touchesWall( mBox, tiles ) )
{
//move back
mBox.x -= mVelX;
}
Can you see something that can help me please ?I want to get the collision box of the wall to my function touchesWall instead of tiles.
Thanks in advance