def __init__(self, game): Sprite.__init__(self, game) self.images_left = [ PhotoImage(file="images/figure-L1.gif"), PhotoImage(file="images/figure-L2.gif"), PhotoImage(file="images/figure-L3.gif") ] self.images_right = [ PhotoImage(file="images/figure-R1.gif"), PhotoImage(file="images/figure-R2.gif"), PhotoImage(file="images/figure-R3.gif") ] self.image = game.canvas.create_image(self.INITIAL_STICKMAN_X, self.INITIAL_STICKMAN_Y, image=self.images_left[0], anchor='nw') self.x = -0.5 self.y = 0 self.current_image = 0 self.current_image_add = 1 self.jump_count = 0 self.last_time = time.time() self.coordinates = stickmanutils.Coords() game.canvas.bind_all('<KeyPress-Left>', self.turn_left) game.canvas.bind_all('<KeyPress-Right>', self.turn_right) game.canvas.bind_all('<space>', self.jump)
def __init__(self, x, y): Sprite.__init__(self, x, y) if type(self).__name__ == "Platform": self.init_image(fixed_platform) rnd = random.randint(-100, 100) if rnd >= 50: self.spring = Spring( self.x + random.randint(-int(platform_width / 2 - 10), int(platform_width / 2) - 10), self.y - 10) else: self.spring = None
def __init__(self, size=0.1, thickness=0.01, color="white", **kwargs): Sprite.__init__(self, **kwargs) self.size = size self.thickness = thickness self.color = COLORS.get(color, color)
def __init__(self,**kwargs): self.delay = kwargs.pop('delay') self.scene = kwargs.pop('scene') self.count = self.delay Sprite.__init__(self,**kwargs)