2d packman

Blitz3D Forums/Blitz3D Beginners Area/2d packman

The best way to do this (imo) is not to use collisions at all, but have a 2D array holding the wall data. All your sprites (PacMan, ghosts etc.) should be made the same size (e.g. 32x32) so then you set up an array with each element saying whether that 32x32 area of the screen is a wall or a space.

Give your PacMan and Ghosts a position in this array so that when they need to make a change in direction, you can simply reference the array to see if there's a wall in the way or not. Remember: PacMan and the ghosts can only change direction when they're exactly aligned to a position in the grid array.