-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathspriteSheets.py
124 lines (107 loc) · 4.29 KB
/
spriteSheets.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
from cmu_112_graphics import *
# spritesheets and graphs from:
# https://github.com/RRCAT920/Fireboy-and-Watergirl/tree/master/assets
# class that contains all sprite animations for waterGirl
class WaterSprite(object):
def __init__(self):
self.waterHeadSheets = [] # list of water head animation
self.waterBodySheets = [] # list of water body animation
def createWaterStill(self,app,image):
still = []
for i in range(6):
sprite = image.crop((25+134*i, 20, 100+134*i, 100))
still.append(sprite)
for i in range(4):
sprite = image.crop((829+134*i, 23, 904+134*i, 103))
still.append(sprite)
for i in range(5):
sprite = image.crop((4+134*i, 137, 79+134*i, 217))
still.append(sprite)
for i in range(6):
sprite = image.crop((829+134*i, 134, 904+134*i, 214))
still.append(sprite)
for i in range(4):
sprite = image.crop((23+134*i, 265, 98+134*i, 345))
still.append(sprite)
for i in range(5):
sprite = image.crop((846+134*i, 253, 921+134*i, 333))
still.append(sprite)
self.waterHeadSheets.append(still)
def createWaterRun(self,app,image):
run = []
for i in range(3):
sprite = image.crop((22+178*i, 20, 122+178*i, 100))
run.append(sprite)
for i in range(3):
sprite = image.crop((39+178*i, 263, 139+178*i, 343))
run.append(sprite)
for i in range(5):
sprite = image.crop((16+178*i, 144, 116+178*i, 224))
run.append(sprite)
self.waterHeadSheets.append(run)
def createWaterBody(self,app,image):
body = []
body.append(image)
self.waterBodySheets.append(body)
def createWaterBodyRun(self,app,image):
run = []
for i in range(4):
sprite = image.crop((23+135*i, 20, 93+135*i, 100))
run.append(sprite)
for i in range(4):
# sprite = image.crop((687+135*i, 30, 757+135*i, 110))
sprite = image.crop((552+135*i, 30, 622+135*i, 110))
run.append(sprite)
self.waterBodySheets.append(run)
# class that contains all sprite animations for FireSprite
class FireSprite(object):
def __init__(self):
self.fireHeadSheets = [] # 2d list containing all the sprites
self.fireBodySheets = []
def createFireStill(self,app,image):
still = []
for i in range(6):
sprite = image.crop((25+134*i, 20, 100+134*i, 100))
still.append(sprite)
for i in range(4):
sprite = image.crop((834+134*i, 19, 909+134*i, 99))
still.append(sprite)
for i in range(5):
sprite = image.crop((40+134*i, 139, 115+134*i, 219))
still.append(sprite)
for i in range(4):
sprite = image.crop((831+134*i, 141, 906+134*i, 221))
still.append(sprite)
self.fireHeadSheets.append(still)
def createFireRun(self,app,image):
imgL = []
sprite = image.crop((10, 20, 100, 100))
imgL.append(sprite)
for i in range(4):
sprite = image.crop((12+160*i, 134, 102+160*i, 214))
imgL.append(sprite)
for i in range(4):
sprite = image.crop((-1+160*i, 498, 89+160*i, 578))
imgL.append(sprite)
sprite = image.crop((20,257,110,337))
imgL.append(sprite)
sprite = image.crop((16,377,106,457))
imgL.append(sprite)
self.fireHeadSheets.append(imgL)
def createFireBody(self,app,image):
body = []
body.append(image)
self.fireBodySheets.append(body)
def createFireBodyRun(self,app,image):
run=[]
for i in range(3):
sprite = image.crop((23+135*i, 20, 93+135*i, 100))
run.append(sprite)
for i in range(4):
sprite = image.crop((16+135*i, 140, 86+135*i, 220))
run.append(sprite)
sprite = image.crop((13, 261, 83, 341))
run.append(sprite)
self.fireBodySheets.append(run)
waterSprite = WaterSprite()
fireSprite = FireSprite()