class Helper # Returns a loaded map and its dependecies(images,json) # If any are missing then it will load them from files @json_data = {} class < json_tiles['tilecount'] source_height_tiles = (tile_index.to_i / json_tiles['columns'].to_i).to_i# * json_tiles['tileheight'] { w: json_tiles['tilewidth'], h: json_tiles['tileheight'], path: json_tiles['image'].split('mygame/').last.delete('\\'), source_x: ((tile_index % json_tiles['columns']) - 1) * json_tiles['tilewidth'], # source_y gets special treatment source_y: json_tiles['imageheight'] - ((source_height_tiles + 1) * json_tiles['tileheight']), source_w: json_tiles['tilewidth'], source_h: json_tiles['tileheight'] } end end end