-
Notifications
You must be signed in to change notification settings - Fork 0
/
enemies.py
42 lines (36 loc) · 1.11 KB
/
enemies.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
from characters import *
from weapons import *
class Goomba(Character):
def __init__(self,life,x,y,*designs):
self.direction = -1
self.slow = 0.5
super(Goomba,self).__init__(life,x,y,*designs)
def move(self,structure):
if time.time()-self.spawnTime > self.slow:
if self.direction == -1:
if not self.moveLeft(structure):
self.direction = 1
else:
if not self.moveRight(structure):
self.direction = -1
self.spawnTime = time.time()
class Boss(Character):
def __init__(self,life,x,y,*designs):
self.slow = 2
self.fires=[]
self.fireTime=time.time()
self.health = " ####################################"
super(Boss,self).__init__(life,x,y,*designs)
def move(self,structure):
if time.time()-self.spawnTime > self.slow:
self.y = random.randrange(12)
self.spawnTime = time.time()
def gravity(self,structure):
pass
def attack(self):
if time.time()-self.fireTime > self.slow*2:
for i in range(4,7):
fire = Fire(1,self.x - abs(i%5 - 2),self.y+i,"./designs/fire.txt")
fire.cannotCross=['T','|','/','\\','`']
self.fires.append(fire)
self.fireTime = time.time()