Welcome to the new platform of Programmers Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use it's exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
PACMAN GAME - COLLISION DETECTION WITH MAZE WALLS
I am currently still trying to develop my own version of the pacman arcade game.
The problem I have is to do with the movement of pacman within the maze.
My maze is made up of tiles which are 8x8 pixels each.
Pacman is a sprite which is 16x16 pixels in size, same with the ghosts.
Note that a tile containing part of a wall also has "moving space" which means that pacman can move onto some of the tile even although the tile is classed as a wall tile.
This can be observed by placing an 8x8 grid over a snapshot of the arcade version.
I have tried a method which will detect whether the tile is a wall or not, if it is a wall then pacman will continue to move until he is halfway into the tile before stopping.
Another method is to use a counter which counts 8 pixels from pacmans previous position (note that I am using the centre of pacman sprite as the position reference).
I have downloaded versions of pacman with source code but these versions only seem to have pacman as an 8x8 sprite as with the tiles and pacman's movement is restricted to one tile at a time.
I need pacman to be able to move smoothly one pixel at a time between tiles and be able to move back and forward at will without having to wait until movement onto next tile before changing direction.
Can anyone suggest a way of solving this problem.
I would be grateful for any advice that can be provided.