newGroup = LayeredDirty() groupList.append(newGroup) def drawGroup(group): dirty = group.draw(MAINWINDOW) pygame.display.update(dirty) def drawAllGroups(): for g in groupList: drawGroup(g) #dirty dirty sprites def addNewSpriteToGroupByIndex(directory,filename,groupIndex,(xOffset,yOffset)): image = pygame.image.load(os.path.join(directory,filename)) sprite = DirtySprite() sprite.image = image rect = image.get_rect() rect.move_ip(xOffset,yOffset) sprite.rect = rect groupList[groupIndex].add(sprite) def isWithinSquareByCoordinate(testx,testy,x1,y1,x2,y2): if testx > x1 and testx < x2 and testy > y1 and testy < y2: return True return False # set up the colors global BLACK global GREY global GRAY global WHITE global RED global GREEN global BLUE global BGCOLOR