-
Notifications
You must be signed in to change notification settings - Fork 0
/
addons.py
132 lines (100 loc) · 2.85 KB
/
addons.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
# COIN = 'C'
# COINRATE = 100
class Generate:
def __init__(self):
pass
def create(self,x,xlim):
import configs
import random
''' get a random (x,y) in current frame
render as set of 4,6 like the madolorian '''
cy = random.randint(5,configs.HEIGHT-3)
cx = random.randint(x,xlim)
return (cy,cx)
def select(self,rate):
import random as rd
return (rd.randrange(0,rate,1)%(rate-1)==0)
class Coins(Generate):
def __init__(self):
super().__init__()
self.COINCHAR = 'C'
# self.COIN = '$'
self.__COINRATE = 100
def getcoinrate(self):
return self.__COINRATE
class Speedboost(Generate):
def __init__(self):
super().__init__()
self.SPEED='>'
self.__SPEEDRATE = 150
self.__framespeed = 4
def getspeedrate(self):
return self.__SPEEDRATE
def getframrate(self):
return self.__framespeed
class Shield(Generate):
def __init__(self):
super().__init__()
self.SHIELD='S'
self.__SHIELDRATE = 200
def getshieldtrate(self):
return self.__SHIELDRATE
class Beam(Generate):
def __init__(self):
ORIENTATIONS = ['v','h','u','d']
import random
super().__init__()
self.__life = random.randint(1,4)
self.__orientation = random.choice(ORIENTATIONS)
self.BEAMRATE = 1000
self.__BEAMLEN = 5
self.BEAMCHAR='*'
self.beamlen = random.randint(1,self.__BEAMLEN)
def getlife(self):
return self.__life
def getbeamrate(self):
return self.BEAMRATE
def getorientation(self):
return self.__orientation
def getbeamlen(self):
return self.__BEAMLEN
class Magnet(Generate):
def __init__(self):
super().__init__()
self.__MAGRATE = 1000
self.MAGCHAR = 'M'
pass
def getmagrate(self):
return self.__MAGRATE
class Bossenemy(Generate):
def __init__(self):
super().__init__()
self.__SHOOTRATE = 50
self.__x=0
self.__y=0
self.__timetoatack=0
self.__lives=10
def getx(self):
return self.__x
def getlives(self):
return self.__lives
def gety(self):
return self.__y
def getshootrate(self):
return self.__SHOOTRATE
def settime(self):
self.__timetoatack=1
def timetoattack(self):
return self.__timetoatack
def shootselect(self):
rate = self.__SHOOTRATE
import random as rd
return (rd.randrange(0,rate,1)%(rate-1)==0)
def lucky(self):
return self.shootselect()
def setx(self,x):
self.__x=x
def sety(self,y):
self.__y=y
def loselife(self):
self.__lives-=1