当前位置: 首页>>代码示例>>Python>>正文


Python Polygon.__init__方法代码示例

本文整理汇总了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_')
开发者ID:251,项目名称:shaape,代码行数:9,代码来源:arrow.py

示例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)
开发者ID:adirksen,项目名称:Python,代码行数:11,代码来源:Ship.py

示例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
开发者ID:majormoses,项目名称:asteroids,代码行数:15,代码来源:ship.py

示例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)
开发者ID:rrydman,项目名称:Asteroids,代码行数:17,代码来源:Rock.py

示例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) 
开发者ID:majormoses,项目名称:asteroids,代码行数:23,代码来源:rock.py

示例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_')
开发者ID:bmustiata,项目名称:shaape,代码行数:7,代码来源:arrow.py

示例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
开发者ID:doug3230,项目名称:Tetris-Clone,代码行数:6,代码来源:cursors.py


注:本文中的polygon.Polygon.__init__方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。