class CrazyPlayer(Player): orect = pygame.Rect(10, 4, 12, 24) rng = 1 bombs = 2 pen = True iaconv = {(0, -1): imgstrip("Men/CManu"), (0, 1): imgstrip("Men/CMan"), (1, 0): imgstrip("Men/CManr"), (-1, 0): imgstrip("Men/CManl")} iconv = {k:v[0] for k,v in iaconv.iteritems()} anitick=0 def altbomb(self, world): while not self.moving: rx=randint(0,19) ry=randint(0,19) if world.is_clear(rx,ry): self.place(rx,ry) break def get_img(self): self.anitick=(self.anitick+1)%32 return self.iaconv[(self.dx,self.dy)][self.anitick//8]
class FGhost(Entity): imgs = imgstrip("FGhost") img = imgs[0] anitick = 0 orect = pygame.Rect(8, 14, 16, 12) def update(self, world, events): if self.anitick == 15: self.anitick = 0 p = world.get_p(self.x, self.y) if p.x < self.x: self.move(-1, 0, 2, world) elif p.x > self.x: self.move(1, 0, 2, world) elif p.y > self.y: self.move(0, 1, 2, world) elif p.y < self.y: self.move(0, -1, 2, world) else: self.anitick += 1 self.img = self.imgs[self.anitick // 4]
class FireGhost(Ghost): imgs = imgstrip("FireGhost") img = imgs[0] fspawn = True def update(self, world, events): if self.fspawn: world.e.append(OrbitFireball(96, 2, self)) self.fspawn = False if self.anitick == 31: self.anitick = 0 p = world.get_p(self.x, self.y) if p.x < self.x: self.move(-1, 0, 1, world) elif p.x > self.x: self.move(1, 0, 1, world) elif p.y > self.y: self.move(0, 1, 1, world) elif p.y < self.y: self.move(0, -1, 1, world) else: self.anitick += 1 self.img = self.imgs[self.anitick // 8]
class TGhost(Ghost): timgs = imgstrip("TGhost") img = timgs[0] hp = 1 def update(self, world, events): if self.anitick == 31: self.anitick = 0 p = world.get_p(self.x, self.y) if p.x < self.x: self.move(-1, 0, 1, world) elif p.x > self.x: self.move(1, 0, 1, world) elif p.y > self.y: self.move(0, 1, 1, world) elif p.y < self.y: self.move(0, -1, 1, world) else: self.anitick += 1 if self.hp: self.img = self.timgs[self.anitick // 8] else: self.img = self.imgs[self.anitick // 8]