本文整理汇总了Python中shape.Shape.at_bottom方法的典型用法代码示例。如果您正苦于以下问题:Python Shape.at_bottom方法的具体用法?Python Shape.at_bottom怎么用?Python Shape.at_bottom使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类shape.Shape
的用法示例。
在下文中一共展示了Shape.at_bottom方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Tetris
# 需要导入模块: from shape import Shape [as 别名]
# 或者: from shape.Shape import at_bottom [as 别名]
#.........这里部分代码省略.........
self.START[0],
self.START[1] + line * self.TILEW))
pygame.display.update()
pygame.time.wait(80)
# remove filled lines
[self.board.pop(l) for l in sorted(filled, reverse=True)]
# fill with blank lines
[self.board.insert(0, [None] * self.W) for l in filled]
self.get_score(len(filled))
def get_score(self, num):
self.killed += num
self.score += num * num * 10 * self.level
self.level = 1 + self.killed // 10
self.time = self.SPACE * 0.9 ** (self.level - 1)
def add_to_board(self):
for x in xrange(self.shape.SHAPEW):
for y in xrange(self.shape.SHAPEH):
if self.shape.shape[y][x]:
self.board[self.shape.y+y][self.shape.x+x] = Tile(
self.shape.color,self.shape._image[self.shape.index])
def create_board_image(self):
self.board_image.fill((0, 0, 0))
for x in xrange(self.H):
for y in xrange(self.W):
if self.board[x][y]:
rect = pygame.Rect(y * self.TILEW, x * self.TILEW,
self.TILEW, self.TILEW)
self.board_image.blit(self.board[x][y].image, rect)
def next(self):
if self.shape.at_bottom():
play_sound('drop')
self.check_line()
self.shape.new()
self.display_info()
else:
self.shape.move(0, 1)
def draw(self):
self.screen.blit(self.board_image, self.START)
self.shape.draw(self.screen)
if self.pause:
util.myprint(self.screen, "PAUSE",
(self.START[0]+50, self.START[1]+200), "m")
def display_info(self):
self._display_next()
self._display_score()
def _display_score(self):
try:
self._score_board
except AttributeError:
self._score_board = (
self.START[0] + self.WIDTH + 30,
self.START[1] + 100,
200, 260)
self._score_level = (
self._score_board[0] + 10,
self._score_board[1] + 10)
self._score_level_v = (
self._score_board[0] + 30,
self._score_board[1] + 50)