Javascript port of a Flash AS3 game