Creating game in javascript