comparison nagslang/mutators.py @ 56:b9430b4a48da

Now with a werewolf
author Stefano Rivera <stefano@rivera.za.net>
date Sun, 01 Sep 2013 18:51:06 +0200
parents c62ed518e5c8
children 72a91d64c088
comparison
equal deleted inserted replaced
55:26d7bb8c09c8 56:b9430b4a48da
1 '''Mutations to apply to images''' 1 '''Mutations to apply to images'''
2 2
3 import pygame 3 import pygame
4 from pygame.transform import rotate 4 from pygame.transform import rotate, flip
5 5
6 6
7 class Mutator(object): 7 class Mutator(object):
8 def __init__(self, func, *args): 8 def __init__(self, func, *args):
9 self._func = func 9 self._func = func
45 # Rotation 45 # Rotation
46 R90 = Mutator(rotate, 90) 46 R90 = Mutator(rotate, 90)
47 R180 = Mutator(rotate, 180) 47 R180 = Mutator(rotate, 180)
48 R270 = Mutator(rotate, -90) 48 R270 = Mutator(rotate, -90)
49 49
50 FLIP_H = Mutator(flip, True, False)
51 FLIP_V = Mutator(flip, False, True)
52
50 # Colour 53 # Colour
51 RED = Colour((255, 0, 0)) 54 RED = Colour((255, 0, 0))
52 GREEN = Colour((0, 255, 0)) 55 GREEN = Colour((0, 255, 0))
53 BLUE = Colour((0, 0, 255)) 56 BLUE = Colour((0, 0, 255))