2d game in JavaScript