How to create collisions on maze walls similar to labyrinth?

Good day to all!

I am trying to create a game similar to “Labyrinth”, The problem I have is how am
I going to detect if the player collides with the walls? I have a single image that
displays the wall. Do I need to create different CCRects on each horizontal and vertical wall?
or are there any tutorials that points to my problem?

Thanks!

Hi,

You could use Box2d collisions system (I dont recommend, too much complexity for a simple thing), or just use CCRectangles to check for collisions.

BR,

JB

Damn, I was trying to avoid box2D because I am having a hard time using box2d since
I am a newbie in cocos2d-x. Thanks for the answer, guess I have to create a lot of CCRects for each stage.
Thanks again! :slight_smile:

“Labyrinth” as in the original Commodore PET game that did false 3D orthographic projection and incremental map movements? If so, then you don’t need any collision code. You make a 2D map which is just a [x,y] grid of shorts. in that grid, you have your short map to “what is here” and “where can I go.” Then if you try to go a direction that is not supported in the grid[x,y], you stop the user. Simple, no box2d, no physics, nada mate!