本文整理汇总了Python中pymunk.inf方法的典型用法代码示例。如果您正苦于以下问题:Python pymunk.inf方法的具体用法?Python pymunk.inf怎么用?Python pymunk.inf使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pymunk
的用法示例。
在下文中一共展示了pymunk.inf方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create_obstacle
# 需要导入模块: import pymunk [as 别名]
# 或者: from pymunk import inf [as 别名]
def create_obstacle(self, x, y, r):
c_body = pymunk.Body(pymunk.inf, pymunk.inf)
c_shape = pymunk.Circle(c_body, r)
c_shape.elasticity = 1.0
c_body.position = x, y
c_shape.color = THECOLORS["blue"]
self.space.add(c_body, c_shape)
return c_body
示例2: accelerate
# 需要导入模块: import pymunk [as 别名]
# 或者: from pymunk import inf [as 别名]
def accelerate(self, direction):
amt = direction * self.move_power
self.motor.max_force = pymunk.inf
self.motor.rate = amt
示例3: make_body
# 需要导入模块: import pymunk [as 别名]
# 或者: from pymunk import inf [as 别名]
def make_body(rect, moment=pymunk.inf):
if moment is None:
body = pymunk.Body()
else:
body = pymunk.Body(1, moment)
shape = make_hitbox(body, rect)
return body, shape
示例4: create_obstacle
# 需要导入模块: import pymunk [as 别名]
# 或者: from pymunk import inf [as 别名]
def create_obstacle(self, xy1, xy2, r, color):
c_body = pymunk.Body(pymunk.inf, pymunk.inf)
#c_shape = pymunk.Circle(c_body, r)
c_shape = pymunk.Segment(c_body, xy1, xy2, r)
#c_shape.elasticity = 1.0
#c_body.position = x, y
c_shape.friction = 1.
c_shape.group = 1
c_shape.collision_type = 1
c_shape.color = THECOLORS[color]
self.space.add(c_body, c_shape)
return c_body
示例5: add_wall
# 需要导入模块: import pymunk [as 别名]
# 或者: from pymunk import inf [as 别名]
def add_wall(self, pt_from, pt_to):
body = pymunk.Body(body_type=pymunk.Body.STATIC)
ground_shape = pymunk.Segment(body, pt_from, pt_to, 0.0)
ground_shape.friction = 0.8
ground_shape.elasticity = .99
ground_shape.mass = pymunk.inf
self.space.add(ground_shape)
示例6: static_ball
# 需要导入模块: import pymunk [as 别名]
# 或者: from pymunk import inf [as 别名]
def static_ball(p, radius):
"""Creates a ball that remains fixed in place.
:param p: The center point of the ball
:type p: (int, int)
:param radius: The radius of the ball
:type radius: int
:rtype: shape
"""
return _ball(p, radius, pymunk.inf, True)
示例7: static_box
# 需要导入模块: import pymunk [as 别名]
# 或者: from pymunk import inf [as 别名]
def static_box(p, width, height):
"""Creates a box that remains fixed in place.
:param p: The upper left corner of the box
:type p: (int, int)
:param width: The width of the box
:type width: int
:param height: The height of the box
:type height: int
:rtype: shape
"""
return _box(p, width, height, pymunk.inf, True)
示例8: static_rounded_box
# 需要导入模块: import pymunk [as 别名]
# 或者: from pymunk import inf [as 别名]
def static_rounded_box(p, width, height, radius):
"""Creates a box with rounded corners that remains fixed in place.
:param p: The upper left corner of the box
:type p: (int, int)
:param width: The width of the box
:type width: int
:param height: The height of the box
:type height: int
:param radius: The radius of the rounded corners
:type radius: int
:rtype: shape
"""
return _box(p, width, height, pymunk.inf, True, radius)
示例9: static_polygon
# 需要导入模块: import pymunk [as 别名]
# 或者: from pymunk import inf [as 别名]
def static_polygon(vertices):
"""Creates a polygon that remains fixed in place.
:param vertices: A tuple of points on the polygon
:type vertices: ((int, int), (int, int), ...)
:rtype: shape
"""
return _polygon(vertices, pymunk.inf, True)
示例10: static_triangle
# 需要导入模块: import pymunk [as 别名]
# 或者: from pymunk import inf [as 别名]
def static_triangle(p1, p2, p3):
"""Creates a triangle that remains fixed in place.
:param p1: The first point of the triangle
:type p1: (int, int)
:param p2: The second point of the triangle
:type p2: (int, int)
:param p3: The third point of the triangle
:type p3: (int, int)
:rtype: shape
"""
return _triangle(p1, p2, p3, pymunk.inf, True)
示例11: static_text_with_font
# 需要导入模块: import pymunk [as 别名]
# 或者: from pymunk import inf [as 别名]
def static_text_with_font(p, caption, font, size):
"""Creates a text rectangle that remains fixed in place.
:param p: The upper left corner of the text rectangle
:type p: (int, int)
:param caption: The text to display
:type caption: string
:param font: The font family to use
:type font: string
:param size: The point size of the font
:type size: int
:rtype: shape
"""
return _text_with_font(p, caption, font, size, pymunk.inf, True)
示例12: static_line
# 需要导入模块: import pymunk [as 别名]
# 或者: from pymunk import inf [as 别名]
def static_line(p1, p2, thickness):
"""Creates a line segment that remains fixed in place.
:param p1: The starting point of the line segement
:type p1: (int, int)
:param p2: The ending point of the line segement
:type p2: (int, int)
:param thickness: The thickness of the line segement
:type thickness: int
:rtype: shape
"""
return _line(p1, p2, thickness, pymunk.inf, True)