-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathSpiralMeister.py
157 lines (144 loc) · 5.23 KB
/
SpiralMeister.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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
# Get spiral or circle coordinates
import math
from Utils import *
from Options import *
from BattleSprites import *
import Resources
import cPickle
def Spiral(TotalTicks, StartingRadius, TicksPerRevolution, CenterX = 0, CenterY = 0):
Coords = []
for Tick in range(TotalTicks):
Angle = Tick * (math.pi * 2) / float(TicksPerRevolution)
##print "Tick %d angle %f (%f)"%(Tick, Angle, Angle * 180/math.pi)
Radius = StartingRadius * (1 - (Tick / float(TotalTicks)))
X = CenterX + Radius * math.cos(Angle)
Y = CenterY - Radius * math.sin(Angle)
Coords.append((int(X),int(Y)))
return Coords
def Circle(TotalTicks, Radius, TicksPerRevolution, XMult = 1.0, YMult = 1.0, CenterX = 0, CenterY = 0):
Coords = []
for Tick in range(TotalTicks):
Angle = Tick * (math.pi * 2) / float(TicksPerRevolution)
##print "Tick %d angle %f (%f)"%(Tick, Angle, Angle * 180/math.pi)
##Radius = StartingRadius * (1 - Tick / float(TotalTicks))
X = CenterX + XMult * 0.7 * Radius * math.cos(Angle)
Y = CenterY - YMult * 0.7 * Radius * math.sin(Angle)
Coords.append((int(X),int(Y)))
return Coords
def CutePrint(Coords):
Str = "["
for Coord in Coords:
Str += str(Coord)+","
if len(Str)>60:
print Str
Str = ""
print Str+"]"
def CycleList(List, Count = 1):
for Cycle in range(Count):
X = List[0]
del List[0]
List.append(X)
def GetZergImages():
Images = []
for ImageIndex in range(1,6):
Image = Resources.GetImage(os.path.join(Paths.Images, "Magic", "work", "Zergling%d.png"%(ImageIndex)))
Image.set_colorkey(Colors.Black)
Images.append(Image)
ImagesB = []
for ImageIndex in range(1,6):
Image = Resources.GetImage(os.path.join(Paths.Images, "Magic", "work", "Zergling%db.bmp"%(ImageIndex)))
Image.set_colorkey(Colors.Black)
ImagesB.append(Image)
return [Images, ImagesB]
ZergImageCount = 16
AnimationFrames = [0,1,2,3,4,3,2,1]
# Zergling image work:
def Zergify(Screen, Index):
(ZergImages, ZergImagesB) = GetZergImages()
ZergCoords = []
#
Coords = Circle(ZergImageCount, 30, ZergImageCount)
ZergCoords.append(Coords)
#
Coords = Circle(ZergImageCount, 30, ZergImageCount)
CycleList(Coords, ZergImageCount/2)
Coords.reverse()
ZergCoords.append(Coords)
#
Coords = Circle(ZergImageCount, 40, ZergImageCount)
ZergCoords.append(Coords)
#
Coords = Circle(ZergImageCount, 40, ZergImageCount)
CycleList(Coords, ZergImageCount/2)
Coords.reverse()
ZergCoords.append(Coords)
#
Coords = Circle(ZergImageCount, 50, ZergImageCount)
CycleList(Coords, ZergImageCount / 4)
ZergCoords.append(Coords)
#
Coords = Circle(ZergImageCount, 50, ZergImageCount)
CycleList(Coords, ZergImageCount / 3)
Coords.reverse()
ZergCoords.append(Coords)
#
Coords = Circle(ZergImageCount, 60, ZergImageCount)
ZergCoords.append(Coords)
#
Coords = Circle(ZergImageCount, 60, ZergImageCount)
CycleList(Coords, ZergImageCount / 2)
CycleList(Coords)
Coords.reverse()
ZergCoords.append(Coords)
#
Coords = Circle(ZergImageCount, 70, ZergImageCount)
CycleList(Coords, 2 * (ZergImageCount / 3))
ZergCoords.append(Coords)
#
Coords = Circle(ZergImageCount, 20, ZergImageCount)
Coords.reverse()
ZergCoords.append(Coords)
#
Coords = Circle(ZergImageCount, 40, ZergImageCount, 0.5, 2.0)
ZergCoords.append(Coords)
##
Coords = Circle(ZergImageCount, 40, ZergImageCount, 0.7, 1.8)
Coords.reverse()
ZergCoords.append(Coords)
##
Coords = Circle(ZergImageCount, 40, ZergImageCount, 1.5, 0.2)
CycleList(Coords)
CycleList(Coords)
CycleList(Coords)
Coords.reverse()
ZergCoords.append(Coords)
##
Coords = Circle(ZergImageCount, 40, ZergImageCount, 1.3, 0.2)
ZergCoords.append(Coords)
for ZergIndex in range(len(ZergCoords)):
Zerg = ZergCoords[ZergIndex]
##print "ZERG!", Zerg
AnimationFrame = AnimationFrames[(Index + ZergIndex)%len(AnimationFrames)]
Position = Zerg[Index % len(Zerg)]
print "BLIT: %d,%d"%(Position[0]+100, Position[0]+100)
ZergWidth = ZergImages[0].get_rect().width
ZergHeight= ZergImages[0].get_rect().height
if ZergIndex%2:
Screen.blit(ZergImages[AnimationFrame],
(100 - ZergWidth/2 +Position[0], 100 - ZergHeight/2 +Position[1]))
else:
Screen.blit(ZergImagesB[AnimationFrame],
(100 - ZergWidth/2 +Position[0], 100 - ZergHeight/2 +Position[1]))
def GetShivaPositions():
MaxIndex = 700
List = []
for Index in range(MaxIndex):
Angle = Index * (math.pi / 95)
X = 400 + 380 * math.cos(Angle)
Y = 80 + Index * (450 / float(MaxIndex)) + 100 * math.sin(Angle)
List.append((X, Y))
File = open("Summon\\Shiva.dat", "wb")
cPickle.dump(List, File)
File.close()
if __name__ == "__main__":
GetShivaPositions()