Влад Клыков, используй requestAnimationFrame и смотри как уровни можно рисовать:
/***********************
' ' - empty
'·' - point
'•' - energy
'#' - obstacle
'$' - special obstacle
'G' - pacman
'Q' - ghost
************************/
var levels = [
/******* level 1 *******/
'·····················' +
'·#·#·#·#·#·#·#·#·#·#·' +
'·•·#·•·#·····#·•·#·•·' +
'·#·#·#·#·#·#·#·#·#·#·' +
'·····················' +
'###·###·#####·###·###' +
'·····················' +
'·####·###·#·###·####·' +
'·#····# #····#·' +
'···##· ##$## ·##···' +
'·###### #QQQ# ######·' +
'···##· ##### ·##···' +
'·#····# #····#·' +
'·####·###·#·###·####·' +
'··········G··········' +
'###·###·#####·###·###' +
'·····················' +
'·#·#·#·#·#·#·#·#·#·#·' +
'·•·#·•·#·····#·•·#·•·' +
'·#·#·#·#·#·#·#·#·#·#·' +
'·····················',
/******* level 2 *******/
];