本文整理汇总了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, maxSpeed, pos = [0,0]):
Ball.__init__(self, ["pacman-open-right.png"], [0,0], pos)
self.rightImages = [pygame.image.load("pacman-open-right.png"),
pygame.image.load("pacman-closed-right.png")]
self.leftImages = [pygame.image.load("pacman-open-left.png"),
pygame.image.load("pacman-closed-left.png")]
self.upImages = [pygame.image.load("pacman-closed-upwards.png"),
pygame.image.load("pacman-open-upwards.png")]
self.downImages = [pygame.image.load("pacman-closed-downwards.png"),
pygame.image.load("pacman-open-downwards.png")]
self.images = self.rightImages
self.images = self.leftImages
self.images = self.upwardsImages
self.images = self.downwardsImages
self.maxFrame = len(self.images)-1
self.xDirection = "right"
self.yDirection = "none"
self.maxSpeedx = maxSpeed[0]
self.maxSpeedy = maxSpeed[1]
示例2: __init__
# 需要导入模块: from Ball import Ball [as 别名]
# 或者: from Ball.Ball import __init__ [as 别名]
def __init__(self, image, maxSpeed, pos = [0,0]):
Ball.__init__(self, image, [0,0], pos)
self.maxSpeedx = maxSpeed[0]
self.maxSpeedy = maxSpeed[1]
self.didBounceX = False
self.didBounceY = False
示例3: __init__
# 需要导入模块: from Ball import Ball [as 别名]
# 或者: from Ball.Ball import __init__ [as 别名]
def __init__(self, images, maxSpeed, pos = [0,0], mass = 100):#50):
Ball.__init__(self, images, [0,0], mass, pos)
self.originalImage = self.image
self.image = pygame.transform.scale(self.originalImage, (mass, mass))
self.rect = self.image.get_rect(center = self.rect.center)
self.maxSpeedx = maxSpeed[0]
self.maxSpeedy = maxSpeed[1]
self.realSpeedx = self.speedx
self.realSpeedy = self.speedy
self.accControlx = .1 # Higher number means less acceleration effect ie follows mouse movments more closly any number greater than 1 causes more jitter
self.accControly = .1
#self.viscosityX = 4
#self.viscosityY = 4
self.accx = self.accControlx/(mass/50)
self.accy = self.accControly/(mass/50)
self.mass = mass
self.amFollowing = False
示例4: __init__
# 需要导入模块: from Ball import Ball [as 别名]
# 或者: from Ball.Ball import __init__ [as 别名]
def __init__(self, pos):
Ball.__init__(self, "images/Player/pballbu.png", [0,0], pos)
self.upImages = [pygame.image.load("images/Chicken/up-walk1.png"),
pygame.image.load("images/Chicken/up-walk2.png")]
self.downImages = [pygame.image.load("images/Chicken/down-walk1.png"),
pygame.image.load("images/Chicken/down-walk2.png")]
self.rightImages = [pygame.image.load("images/Chicken/right-walk1.png"),
pygame.image.load("images/Chicken/right-walk2.png")]
self.leftImages = [pygame.image.load("images/Chicken/left-walk1.png"),
pygame.image.load("images/Chicken/left-walk2.png")]
self.facing = "up"
self.changed = False
self.images = self.upImages
self.frame = 0
self.maxFrame = len(self.images) - 1
self.waitCount = 0
self.maxWait = 60*.25
self.image = self.images[self.frame]
self.rect = self.image.get_rect(center = self.rect.center)
self.maxSpeed = 5
示例5: __init__
# 需要导入模块: from Ball import Ball [as 别名]
# 或者: from Ball.Ball import __init__ [as 别名]
def __init__(self, pos):
Ball.__init__(self, "PHIL THE NINJA.PNG", [0,0], pos)
self.upImages = [pygame.image.load("PHIL THE NINJA.PNG"),
pygame.image.load("PHIL THE NINJA.PNG"),
pygame.image.load("PHIL THE NINJA.PNG")]
self.downImages = [pygame.image.load("PHIL THE NINJA.PNG"),
pygame.image.load("PHIL THE NINJA.PNG"),
pygame.image.load("PHIL THE NINJA.PNG")]
self.leftImages = [pygame.image.load("PHIL THE NINJA.PNG"),
pygame.image.load("PHIL THE NINJA.PNG"),
pygame.image.load("PHIL THE NINJA.PNG")]
self.rightImages = [pygame.image.load("PHIL THE NINJA.PNG"),
pygame.image.load("PHIL THE NINJA.PNG"),
pygame.image.load("PHIL THE NINJA.PNG")]
self.facing = "up"
self.changed = False
self.images = self.upImages
self.frame = 0
self.maxFrame = len(self.images) - 1
self.waitCount = 0
self.maxWait = 60*.25
self.image = self.images[self.frame]
self.rect = self.image.get_rect(center = self.rect.center)
self.maxSpeed = 10
示例6: __init__
# 需要导入模块: from Ball import Ball [as 别名]
# 或者: from Ball.Ball import __init__ [as 别名]
def __init__(self, image, maxSpeed, pos = [0,0]):
Ball.__init__(self, image, [0,0], pos)
self.maxSpeedx = maxSpeed[0]
self.maxSpeedy = maxSpeed[1]
示例7: __init__
# 需要导入模块: from Ball import Ball [as 别名]
# 或者: from Ball.Ball import __init__ [as 别名]
def __init__(self, myPosition=None, *args, **kwargs):
Ball.__init__(self, *args, **kwargs)
if myPosition is None:
myPosition = Position()
"""State: The position of the ball"""
self.myPosition = myPosition
示例8: __init__
# 需要导入模块: from Ball import Ball [as 别名]
# 或者: from Ball.Ball import __init__ [as 别名]
def __init__(self, pos):
image = "Ball/Food.png"
mass = 20
Ball.__init__(self, [image], [0, 0], mass, pos)