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


Python Ball.__init__方法代码示例

本文整理汇总了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]
开发者ID:KRHS-GameProgramming-2015,项目名称:Manpac,代码行数:28,代码来源:PlayerBall.py

示例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
开发者ID:rcnerd,项目名称:Epic-Pong,代码行数:10,代码来源:PlayerPaddle.py

示例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
开发者ID:KRHS-GameProgramming-2015,项目名称:King-of-the-Pile,代码行数:19,代码来源:Player.py

示例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
开发者ID:KRHS-GameProgramming-2014,项目名称:The-Dot-Eater,代码行数:24,代码来源:PlayerBall.py

示例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
开发者ID:KRHS-GameProgramming-2014,项目名称:SUPER-AWESOME-NINJA-GAME,代码行数:26,代码来源:Ninja.py

示例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]
开发者ID:dmalves,项目名称:JourneyThroughHell,代码行数:6,代码来源:PlayerBall.py

示例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
开发者ID:YogeshIITB,项目名称:Football-Engine,代码行数:8,代码来源:Football.py

示例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)
开发者ID:KRHS-GameProgramming-2015,项目名称:King-of-the-Pile,代码行数:6,代码来源:Food.py


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