I'm building a pacman game. Basically, I want to have a map representation of this window consisting of blocks/tiles. Then as the pacman character/ghost moves i would change their position on the map to represent what's on the screen, and use that for collision detection etc.

How can I build this map, especially since the screen is made of x,y coordinates, so how can I correctly represent them in tiles/on this map?