def draw(self, image = None): if self.state == 'ouch' and timer.blink(0.1): Sprite.draw(self, image, 0.5) else: Sprite.draw(self, image) if self.state == 'frozen' and not self.ice: self.ice = True self.draw(res.getTexture("iceblock")) self.ice = False
def __init__(self, imagename): self.img = res.getTexture(imagename) (self.x, self.y) = (0, 0) (self.vx, self.vy) = (0, 0) (self.h, self.w) = (1.0, 1.0) self.physics = 'standing' self.lev = level.getCurrent() self.state = 'normal' self.nextstate = -1
def __init__(self, tilesetname = "__dummy__"): self.name = tilesetname self.img = res.getTexture(self.name) self.w = self.img.w self.h = self.img.h if self.name != "__dummy__": cf = open("data/tilemaps/%s.pqt" % self.name, "r") self.ttw, self.tth = [int(a) for a in cf.readline().strip().split(",")] self.collision = [] for l in cf.readlines(): self.collision.extend([int(lp) for lp in l.split(" ") if lp]) else: self.ttw, self.tth = 4, 4 self.collisions = [0] * 16 self.scroller = scroll.ScrollView(10, 10) self.scroller.changeArea(self.ttw, self.tth) self.scroller.scrollTo(0, 0)
def __init__(self): self.img = res.getTexture("player") self.x, self.y = 0, 0 self.vx, self.vy = 0, 0 self.w, self.h = 1.0, 0.9 self.health = 100