Spritesheet
Hello!
Quick question;
I have a spritesheet, all sprites are 16x16 and in multiple lines.
I know the width and the height of the sheet.
How would I do to get the coordinates of the n:th sprite?
Assuming you number your sprites starting at zero being the upper-left:
int row = n / numSpritesPerRow;
int col = n % numSpritesPerRow;
int x = col * 16;
int y = row * 16;
int row = n / numSpritesPerRow;
int col = n % numSpritesPerRow;
int x = col * 16;
int y = row * 16;
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement