本文整理汇总了Python中ball.Ball.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python Ball.__init__方法的具体用法?Python Ball.__init__怎么用?Python Ball.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ball.Ball
的用法示例。
在下文中一共展示了Ball.__init__方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from ball import Ball [as 别名]
# 或者: from ball.Ball import __init__ [as 别名]
def __init__(self, stage, pos_x, pos_y, circle_mass, radius, circle_elasticity, color):
Ball.__init__(self, stage, pos_x, pos_y, circle_mass, radius, circle_elasticity, color)
self.circle.collision_type = 1
self.point_value = 0
self.gun_bullet = pygame.image.load(self.stage.graphics_path + "gunbullet.png").convert_alpha()
self.cannon_bullet = pygame.image.load(self.stage.graphics_path + "cannonbullet.png").convert_alpha()
示例2: __init__
# 需要导入模块: from ball import Ball [as 别名]
# 或者: from ball.Ball import __init__ [as 别名]
def __init__(self, x = 0.0, y = 0.0):
Ball.__init__(self, x, y)
if Bar.image is None:
# This is the first time loading the sprite,
# so we need to load the image data
Bar.image = pg.image.load(os.path.join("data","bar.png")).convert()
Bar.image.set_colorkey(0)
self.image = Bar.image
(self.rect.w, self.rect.h) = (self.image.get_rect().w, self.image.get_rect().h)
self.infiniteMass = True
self.moveable = False
示例3: __init__
# 需要导入模块: from ball import Ball [as 别名]
# 或者: from ball.Ball import __init__ [as 别名]
def __init__(self, x = 0.0, y = 0.0):
Ball.__init__(self)
if Blobble.image is None:
# This is the first time loading the sprite,
# so we need to load the image data
Blobble.image = pg.image.load(os.path.join("data","blobble.png")).convert()
Blobble.image.set_colorkey(0)
self.image = Blobble.image
self.rect = self.image.get_rect()
#self.radius = self.rect.w / 2.0
self._setPosition(Vector(x, y))
self.infiniteMass = False
self.moveable = True
self.xAccel = 0.0
self.doJump = False
示例4: __init__
# 需要导入模块: from ball import Ball [as 别名]
# 或者: from ball.Ball import __init__ [as 别名]
def __init__(self,x,y):
Ball.__init__(self, x, y)
self.randomize_color()
self.set_speed(30)
示例5: __init__
# 需要导入模块: from ball import Ball [as 别名]
# 或者: from ball.Ball import __init__ [as 别名]
def __init__(self,x,y):
Ball.__init__(self,x,y)
self._color = "BROWN"
self.set_dimension(10, 10)
self.time_count = 0
self.set_speed(6)
示例6: __init__
# 需要导入模块: from ball import Ball [as 别名]
# 或者: from ball.Ball import __init__ [as 别名]
def __init__(self, x, y, parent):
Ball.__init__(self, x, y)
self.next = parent
self.set_angle(parent.get_angle())
self.color = 'Green'
示例7: __init__
# 需要导入模块: from ball import Ball [as 别名]
# 或者: from ball.Ball import __init__ [as 别名]
def __init__(self, x, y, r, color=(255, 0, 0)):
"""Initialize the game object."""
Ball.__init__(self, (x, y), r)
self.movement = [choice([-1.0, -0.5, 0.5, 1.0]) for _ in [1, 2]]
self.__color = color
示例8: __init__
# 需要导入模块: from ball import Ball [as 别名]
# 或者: from ball.Ball import __init__ [as 别名]
def __init__(self, stage, swing, pos_x, pos_y, circle_mass, radius, circle_elasticity, color):
Ball.__init__(self, stage, pos_x, pos_y, circle_mass, radius, circle_elasticity, color)
self.swing = swing
self.detached = False