PacMan in js using html canvas