def test_withinx1_co1_entirelyoutside_co2(self): co1 = stickmanutils.Coords(100, 100, 101, 101) co2 = stickmanutils.Coords(1, 1, 10, 10) result = stickmanutils.within_x(co1, co2) self.assertFalse(result)
def test_withinx1_co1_entirelyinside_co2(self): co1 = stickmanutils.Coords(1, 1, 2, 2) co2 = stickmanutils.Coords(1, 1, 10, 10) result = stickmanutils.within_x(co1, co2) self.assertTrue(result)
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, game, photo_image, x, y, width, height): Sprite.__init__(self, game) self.photo_image = photo_image self.image = game.canvas.create_image(x, y, image=self.photo_image, anchor='nw') self.coordinates = stickmanutils.Coords(x, y, x + width, y + height)