def __init__(self, x0, y0, poplist, dirs=None, countdown=0, flip=''): ico = images.sprget((flip, Fire.ground[0])) ActiveSprite.__init__(self, ico, x0 * CELL, y0 * CELL) if not countdown: dirs = [] self.poplist = poplist self.gen.append(self.burning(dirs, countdown)) self.setimages(self.cyclic([(flip, n) for n in Fire.ground], 1))
def __init__(self, ico, x, y): import boards if y < -2 * CELL: y = -2 * CELL elif y > boards.bheight: y = boards.bheight x = (x + HALFCELL) & -CELL y = (y + HALFCELL) & -CELL ActiveSprite.__init__(self, ico, x, y) self.wannadx = self.wannady = 0
def __init__(self, x, y, hspeed, author): if hspeed > 0: imgs = PlayerBubbles.right_weapon else: imgs = PlayerBubbles.left_weapon ActiveSprite.__init__(self, images.sprget(imgs[-1]), x, y) self.setimages(self.cyclic(imgs, 2)) self.author = author self.gen.append(self.moving(hspeed)) self.play(images.Snd.Shh)
def __init__(self, dragon, target, timeout): img = images.sprget(PlayerBubbles.explosion[2]) ActiveSprite.__init__(self, img, -img.w, 0) self.dragon = dragon self.target = target self.timeout = timeout self.gen.append(self.follow()) self.recenter(PlayerBubbles.explosion[2]) for imgnum, delay in self.numlist: images.sprget(imgnum) # preload
def __init__(self, arkanoid, bubber, px, py): ico = images.sprget(('ark-paddle', bubber.pn)) ActiveSprite.__init__(self, ico, px - (ico.w - 2 * CELL) // 2, py - (ico.h - 2 * CELL) // 2) self.arkanoid = arkanoid self.bubber = bubber self.timeleft = None self.gen.append(self.bounce_down()) self.gen.append(self.bkgndstuff()) self.arkanoid.paddles.append(self)
def __init__(self, paddle): self.paddle = paddle imglist1 = GreenAndBlue.new_bubbles[paddle.bubber.pn] ActiveSprite.__init__(self, images.sprget(imglist1[0]), paddle.x + paddle.ico.w // 2, paddle.y - Ball.Y_MARGIN) self.missed = 0 self.setimages(self.imgseq(imglist1[1:], 6)) self.bounceangle(0.2) self.gen.append(self.flying())
def __init__(self, x, y, poplist): ActiveSprite.__init__(self, images.sprget(SpinningBalls.free[-1]), x, y) self.poplist = poplist self.gen.append(self.dropping()) imgs = SpinningBalls.free if random.random() < 0.5: imgs = list(imgs) imgs.reverse() self.setimages(self.cyclic(imgs, random.randrange(2, 5))) self.touchable = 1
def __init__(self, mnstrdef, x=None, y=None, dir=None, in_list=None): self.mdef = mnstrdef self.ptag = None if dir is None: dir = mnstrdef.dir if x is None: x = mnstrdef.x * CELL if y is None: y = mnstrdef.y * CELL self.dir = dir ActiveSprite.__init__(self, images.sprget(self.imgrange()[0]), x, y) self.gen.append(self.waiting()) if in_list is None: in_list = BubPlayer.MonsterList self.in_list = in_list self.in_list.append(self) self.no_shoot_before = 0
def __init__(self, x, y, dir, watercells, poplist, repeat): ActiveSprite.__init__(self, images.sprget(Water.top), x, y) self.poplist = poplist self.take_with_me = [] self.ping = 0 self.repeat = repeat self.watercells = watercells self.touchable = repeat % 3 == 1 if (x, y, dir) not in watercells: watercells[x, y, dir] = self if None not in watercells or not watercells[None].alive: self.in_charge() else: watercells[x, y, dir].join(self)
def __init__(self, owner, dx=CELL, dy=0): self.owner = owner self.speed = owner.dir * self.speed if owner.dir < 0: nimages = owner.mdef.left_weapon else: nimages = owner.mdef.right_weapon ActiveSprite.__init__(self, images.sprget(nimages[0]), owner.x, owner.y + dy) self.step((owner.ico.w - self.ico.w) // 2, (owner.ico.h - self.ico.h) // 2) if not self.blocked(): self.step(dx * owner.dir, 0) if len(nimages) > 1: self.setimages(self.cyclic(nimages, 3)) self.gen.append(self.moving())
def __init__(self, camel, bubber, dcap, x, y, dirhint=None): self.bubber = bubber self.dcap = dcap self.camel = camel self.shotlist = camel.score.setdefault(bubber, {}) if x < x_min: x = x_min elif x > x_max: x = x_max if y < 4 * CELL: y = 4 * CELL elif y > (curboard.height - 4) * CELL - 36: y = (curboard.height - 4) * CELL - 36 if dirhint not in (1, -1): controldelay = 5 if x < boards.bwidth // 2: dir = 1 else: dir = -1 else: controldelay = 20 if x < boards.bwidth // 3: dir = 1 elif x >= boards.bwidth * 2 // 3: dir = -1 else: dir = dirhint if dir > 0: self.angle = 0 self.flipped = False else: self.angle = 180 self.flipped = True ActiveSprite.__init__(self, self.getico(), x, y) self.fx = self.x self.fy = self.y self.controlgen = self.control(delay=controldelay) self.gen.append(self.fly()) self.gen.append(self.controlgen) self.gen.append(self.blink()) self.gen.append(self.bob())
def __init__(self, tron, bubber, dcap, cx, cy, dir): self.tron = tron self.bubber = bubber self.dcap = dcap self.cx = cx self.cy = cy self.dir = dir self.icons = {} for key in localmap: ico = images.sprget((key, bubber.pn)) key = key[1:] self.icons[key] = ico if len(key) == 4: dx1, dy1, dx2, dy2 = key key = -dx2, -dy2, -dx1, -dy1 self.icons[key] = ico ActiveSprite.__init__(self, self.icons[self.dir], self.cx*8-2, self.cy*8-2) self.gen.append(self.trailing())
def __init__(self, bubber, x, y, dir, dcap=DCAP): self.bubber = bubber self.dir = dir icobubber = dcap.get('bubbericons', bubber) ActiveSprite.__init__(self, icobubber.icons[0, dir], x, y) self.fire = 0 self.up = 0.0 self.watermoveable = 0 self.dcap = dcap.copy() self.dcap.update(self.bubber.pcap) BubPlayer.DragonList.append(self) self.gen.append(self.normal_movements()) self.overlaysprite = None self.overlayyoffset = 4 self.hatsprite = None self.hatangle = 1 self.isdying = 0 self.lifegained = 0 self.playing_fish = False if BubPlayer.SuperSheep: self.become_monster('Sheep', immed=1) elif BubPlayer.SuperFish: self.become_fish()
def __init__(self, x, y, poplist=None): ActiveSprite.__init__(self, images.sprget(Fire.drop), x, y) self.poplist = poplist or [None] self.gen.append(self.dropping())
def __init__(self, bubber, x, y): ico = images.sprget(('t-brick1', bubber.pn)) ActiveSprite.__init__(self, ico, x, y) self.tx = x // CELL self.ty = y // CELL self.bubber = bubber
def __init__(self, bubber, saved_caps, bubble): ico = images.sprget(('eyes', 0, 0)) ActiveSprite.__init__(self, ico, bubble.x, bubble.y) self.bubber = bubber self.dcap = saved_caps self.gen = [self.playing_bubble(bubble)]
def __init__(self, plane, x, y, angle, steps=0): ico = images.sprcharacterget('.') ActiveSprite.__init__(self, ico, x - 4, y - 12) self.plane = plane self.angle = angle self.gen.append(self.moving(steps))
def __init__(self, x, y, dir, poplist, diry=0): ActiveSprite.__init__(self, images.sprget(Lightning.fired), x, y) self.dir = int(13 * dir) self.diry = int(13 * diry) self.gen.append(self.moving(poplist))