本文整理汇总了Python中Tools.Graphics.Graphics.getSurfaceHeight方法的典型用法代码示例。如果您正苦于以下问题:Python Graphics.getSurfaceHeight方法的具体用法?Python Graphics.getSurfaceHeight怎么用?Python Graphics.getSurfaceHeight使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tools.Graphics.Graphics
的用法示例。
在下文中一共展示了Graphics.getSurfaceHeight方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: SuperPixelBros
# 需要导入模块: from Tools.Graphics import Graphics [as 别名]
# 或者: from Tools.Graphics.Graphics import getSurfaceHeight [as 别名]
class SuperPixelBros(object):
"""
SuperPixelBros is a class that hanles function calling and processing.
makes sure the level is generated.
makes sure the player get the right data.
"""
def __init__(self):
self.graphics = Graphics(matrix_width, matrix_height)
self.players = []
self.player = Player((9, 7), BLUE, self.graphics, self)
self.level = level1
def handleInput(self):
self.player.handleInput()
def process(self):
self.player.process()
def draw(self):
self.graphics.fill(BLACK)
# draw the map.
surfaceheight = self.graphics.getSurfaceHeight()
level_matrix = self.graphics.toMatrix(self.level, surfaceheight)
for y in self.graphics.heightRange:
for x in self.graphics.widthRange:
tile = level_matrix[x][y]
# draw the map flipped
self.graphics.drawPixel(self.graphics.width - x - 1, y, tile)
# draw the player.
self.player.draw()
def generate(self):
# self.handleInput()
# self.process()
# self.draw()
return self.graphics.getSurface()