Created
January 24, 2017 04:41
-
-
Save cbscribe/3d9fe81459aa86d0374ff626f2d25c87 to your computer and use it in GitHub Desktop.
basic spritesheet class
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Spritesheet: | |
# utility class for loading and cutting spritesheets | |
def __init__(self, filename): | |
self.spritesheet = pg.image.load(filename).convert_alpha() | |
def get_image_by_rect(self, x, y, w, h): | |
r = pg.Rect(x, y, w, h) | |
return self.spritesheet.subsurface(r) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment