本文整理汇总了Python中polygon.Polygon.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python Polygon.__init__方法的具体用法?Python Polygon.__init__怎么用?Python Polygon.__init__使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类polygon.Polygon
的用法示例。
在下文中一共展示了Polygon.__init__方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from polygon import Polygon [as 别名]
# 或者: from polygon.Polygon import __init__ [as 别名]
def __init__(self, position = (0, 0), node_list = []):
Polygon.__init__(self, node_list)
Translatable.__init__(self, position)
Named.__init__(self)
self.__connected_objects = []
self.__pointed_objects = []
self.add_name('_arrow_')
示例2: __init__
# 需要导入模块: from polygon import Polygon [as 别名]
# 或者: from polygon.Polygon import __init__ [as 别名]
def __init__(self, position, rotation, color):
p1 = Point(0,-4)
p2 = Point(0,4)
p3 = Point(20,0)
self.outline = [p3, p1, p2]
self.position = position
self.rotation = rotation
self.color = color
Polygon.__init__(self, self.outline, self.position, self.rotation, self.color)
示例3: __init__
# 需要导入模块: from polygon import Polygon [as 别名]
# 或者: from polygon.Polygon import __init__ [as 别名]
def __init__(self):
shape = [Point(24, 0), Point(-12, -12), Point(0, 0), Point(-12, 12)]
position = Point(config.SCREEN_X/2, config.SCREEN_Y/2)
self.rotation = config.SHIP_INITIAL_DIRECTION
color = config.SHIP_COLOR
Polygon.__init__(self, shape, position, self.rotation, color)
self.accelerate = (0, 0)
self.stop = Point(0, 0)
pygame.mixer.init()
self.fire_sfx = pygame.mixer.Sound("laser.wav")
self.count = 5
self.shield_health = 100
self.nuke_count = 1
示例4: __init__
# 需要导入模块: from polygon import Polygon [as 别名]
# 或者: from polygon.Polygon import __init__ [as 别名]
def __init__(self, position, rotation, color, rotation_speed, motion):
self.outline = []
for angle in range(0, 360, 360/config.ROCK_POLYGON_SIZE):
radius = random.uniform(config.ROCK_MIN_RADIUS, config.ROCK_MAX_RADIUS)
angle_rad = math.radians(angle)
(x,y) = math.cos(angle_rad) * radius, math.sin(angle_rad) * radius
p = Point(x,y)
self.outline.append(p)
self.position = position
self.rotation = rotation
self.color = color
self.rotation_speed = rotation_speed
self.motion = motion
Polygon.__init__(self, self.outline, self.position, self.rotation, self.color)
self.accelerate(self.motion)
示例5: __init__
# 需要导入模块: from polygon import Polygon [as 别名]
# 或者: from polygon.Polygon import __init__ [as 别名]
def __init__(self):
shape = []
position = Point(random.uniform(0, config.SCREEN_X), random.uniform(0, config.SCREEN_Y))
color = config.ASTEROID_COLOR
self.speed = random.uniform(config.ASTEROID_MIN_SPEED, config.ASTEROID_MAX_SPEED)
rotation = random.uniform(0.0, 359.99)
if random.randint(0, 1):
self.speed *= -1
for i in range(config.ASTEROID_POLYGON_SIZE):
radius = random.uniform(config.ASTEROID_MIN_RADIUS, config.ASTEROID_MAX_RADIUS)
radian = math.radians(i * 360 / config.ASTEROID_POLYGON_SIZE)
x = math.cos(radian) * radius
y = math.sin(radian) * radius
shape.append(Point(x, y))
Polygon.__init__(self, shape, position, rotation, color)
self.ast_speed = random.uniform(config.ASTEROID_MIN_SPEED, config.ASTEROID_MAX_SPEED)
self.accelerate(self.ast_speed)
示例6: __init__
# 需要导入模块: from polygon import Polygon [as 别名]
# 或者: from polygon.Polygon import __init__ [as 别名]
def __init__(self, position = (0, 0), node_list = []):
Polygon.__init__(self, node_list)
Translatable.__init__(self, position)
Named.__init__(self)
self.add_name('_arrow_')
示例7: __init__
# 需要导入模块: from polygon import Polygon [as 别名]
# 或者: from polygon.Polygon import __init__ [as 别名]
def __init__(self, **kwargs):
points = [(0, 0), (0, 1), (1, 0.5)]
Polygon.__init__(self, points=points, **kwargs)
return