Getting a top-left position of a tile inside a tileset
问题 I have a tileset(a image full of other small images). And I wanna get one of those little images called tile so I can do something with it. I know the size of each tile(they're all the same size). I have two equations: x = (i % tiles_hor) * tile_h y = (i % tiles_ver) * tile_w x = (i % tiles_hor) * tile_w y = (i / tiles_hor) * tile_w where i means the index of the tile i wanna get; tiles_hor is the number of tiles horizontally; tiles_ver is the number of tiles vertically; tile_w and tile_h is