示例#1
0
文件: room.py 项目: hakuji/game3
 def walls_from_rect(cls, rect, color = Color.ARTICHOKE):
     x, y, w, h = rect.dimension()
     left = vertex_list_from_rect(x, y, WALL_WIDTH, WALL_WIDTH + h, color)
     top = vertex_list_from_rect(x, y + h, w, WALL_WIDTH, color)
     bottom = vertex_list_from_rect(x, y, w, WALL_WIDTH, color)
     right = vertex_list_from_rect(x + w, y, WALL_WIDTH, WALL_WIDTH + h, color)
     return (left, top, bottom, right)
示例#2
0
文件: obj.py 项目: hakuji/game3
 def draw(self):
     if DEBUG:
         x, y = self.x, self.y
         w, h = self.w, self.h
         rect = vertex_list_from_rect(x, y, w, h)
         rect.draw(pyglet.gl.GL_QUAD_STRIP)
     super(Object, self).draw()
示例#3
0
文件: room.py 项目: hakuji/game3
 def set_visual(self):
     """Method that sets the visual representation of an object"""
     self.walls = self.walls_from_rect(self.outer_rect)
     if self.horizontal:
         self.awall = self.walls[1]
         self.bwall = self.walls[2]
     else:
         self.awall = self.walls[0]
         self.bwall = self.walls[3]
     d = self.inner_rect.dimension()
     self.floor = vertex_list_from_rect(d[0], d[1], d[2], d[3], ROOM_FLOOR_COLOR)
示例#4
0
文件: screens.py 项目: hakuji/game3
 def draw(self):
     proportion = float(self.hero.health) / self.hero.health_total
     color = (int((1.0 - proportion) * 255), int(proportion * 255), 0, 255)
     width = int(HEALTH_BAR_WIDTH * proportion)
     bar = vertex_list_from_rect(
         self.value.x,
         self.value.y - 3,
         width,
         HEALTH_BAR_HEIGHT,
         color)
     bar.draw(pyglet.gl.GL_QUAD_STRIP)
     super(HealthBar, self).draw()
示例#5
0
文件: util.py 项目: hakuji/game3
 def __init__(self, origin, x, y, w, h):
     self.strength = origin.strength
     self.remove = False
     self.sprite = vertex_list_from_rect(x, y, w, h)
     self.rect = Rect.from_dimensions(x, y, w, h)
示例#6
0
文件: room.py 项目: hakuji/game3
 def set_visual(self):
     """Method that sets the visual representation of an object"""
     self.walls = self.walls_from_rect(self.outer_rect)
     d = self.inner_rect.dimension()
     self.floor = vertex_list_from_rect(d[0], d[1] - 2, d[2], d[3], ROOM_FLOOR_COLOR)