Platform game in javascript