def drawLives(): posx = (-stage.width / 2) + 3 for x in xrange(1, game.lives + 1): posx += 1 drawTile(posx, (-stage.height / 2) - 1, theme.get_tile('lives'), theme.get_color('lives')) posx += 1 drawTile(posx, (-stage.height / 2) - 1, theme.get_tile('border-h'), theme.get_color('border'))
def drawSnake(): for part in game.snake: drawTile( part[0], part[1], theme.get_tile('snake-body'), theme.get_color('snake') ) # Clean last tile drawTile( game.lastPos[0], game.lastPos[1], theme.get_tile('bg'), theme.get_color('bg') )
def drawApples(): for apple in game.apples: drawTile( apple[0], apple[1], theme.get_tile('apple'), theme.get_color('apple') )
def drawSnake(): for part in game.snake: drawTile( part[0], part[1], theme.get_tile('snake-body'), theme.get_color('snake') )
def drawBorders(): for y in range(stage.boundaries['top'], stage.boundaries['bottom']): drawTile(stage.boundaries['left'] - 1, y, theme.get_tile('border-v'), theme.get_color('border')) drawTile(stage.boundaries['right'], y, theme.get_tile('border-v'), theme.get_color('border')) for x in range(stage.boundaries['left'], stage.boundaries['right']): drawTile(x, stage.boundaries['top'] - 1, theme.get_tile('border-h'), theme.get_color('border')) drawTile(x, stage.boundaries['bottom'], theme.get_tile('border-h'), theme.get_color('border')) drawTile(stage.boundaries['left'] - 1, stage.boundaries['top'] - 1, theme.get_tile('border-c'), theme.get_color('border')) drawTile(stage.boundaries['left'] - 1, stage.boundaries['bottom'], theme.get_tile('border-c'), theme.get_color('border')) drawTile(stage.boundaries['right'], stage.boundaries['top'] - 1, theme.get_tile('border-c'), theme.get_color('border')) drawTile(stage.boundaries['right'], stage.boundaries['bottom'], theme.get_tile('border-c'), theme.get_color('border'))
def drawBorders(): tile_v = theme.get_tile('border-v') tile_h = theme.get_tile('border-h') tile_c = theme.get_tile('border-c') color = theme.get_color('border') x_left = stage.boundaries['left'] x_right = stage.boundaries['right'] y_top = stage.boundaries['top'] y_bottom = stage.boundaries['bottom'] for y in range(y_top, y_bottom): drawTile(x_left - 1, y, tile_v, color) drawTile(x_right, y, tile_v, color) for x in range(x_left, x_right): drawTile(x, y_top - 1, tile_h, color) drawTile(x, y_bottom, tile_h, color) drawTile(x_left - 1, y_top - 1, tile_c, color) drawTile(x_left - 1, y_bottom, tile_c, color) drawTile(x_right, y_top - 1, tile_c, color) drawTile(x_right, y_bottom, tile_c, color)
def drawGame(): for y in range(stage.boundaries['top'], stage.boundaries['bottom']): for x in range(stage.boundaries['left'], stage.boundaries['right']): drawTile(x, y, theme.get_tile('bg'), theme.get_color('bg')) drawBorders() drawText()