Relative Content

Tag Archive for javascriptpythonwebgame-development

How to detect collision in pacman game?

Following is the boilerplate for Pacman game that I need to complete. I’m having problems with detecting when the player is going to collide with walls. The problem is I don’t know where the player is relative to the maze. Like if the player moved one tile from the maze array on keydown, I could work out the position and check adjacent tiles for collision. But since the player moves in “1px” increment on a keydown, I can’t track which tile it is currently on.