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


Python GameObject.__init__方法代码示例

本文整理汇总了Python中gameobject.GameObject.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python GameObject.__init__方法的具体用法?Python GameObject.__init__怎么用?Python GameObject.__init__使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在gameobject.GameObject的用法示例。


在下文中一共展示了GameObject.__init__方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from gameobject import GameObject [as 别名]
# 或者: from gameobject.GameObject import __init__ [as 别名]
 def __init__(self, name, xy, tiletype, can_be_eaten=True, hp_gain=0, mp_gain=0):
     GameObject.__init__(self, xy, tiletype, solid=False, draw_once_seen = False)
     self.name = name
     self.time_to_live = 10
     self.can_be_eaten = can_be_eaten
     self.hp_gain = hp_gain
     self.mp_gain = mp_gain
开发者ID:ludamad,项目名称:7DayRL2013,代码行数:9,代码来源:enemies.py

示例2: __init__

# 需要导入模块: from gameobject import GameObject [as 别名]
# 或者: from gameobject.GameObject import __init__ [as 别名]
 def __init__(self):
     GameObject.__init__(self)
     self.x = 0
     self.y = 0
     self.width = BLOCK_SIZE * 10
     self.height = BLOCK_SIZE * 10
     self.color = 0xFFFFFF
     self.shape = [
         [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
         [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
         [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
         [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
         [0, 0, 0, 0, 1, 1, 0, 0, 0, 0],
         [0, 0, 0, 0, 1, 1, 0, 0, 0, 0],
         [0, 0, 0, 0, 1, 1, 0, 0, 0, 0],
         [0, 1, 1, 1, 1, 1, 1, 1, 1, 0],
         [0, 1, 1, 1, 1, 1, 1, 1, 1, 0],
         [1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
     ]
     self.blocks = []
     for row_index, row in enumerate(self.shape):
         myrow = []
         for col_index, col in enumerate(row):
             if col == 1:
                 myrow.append(Block(self, self.color, col_index * BLOCK_SIZE, row_index * BLOCK_SIZE))
         self.blocks.append(myrow)
开发者ID:davidejones,项目名称:spaceinvaders,代码行数:28,代码来源:player.py

示例3: __init__

# 需要导入模块: from gameobject import GameObject [as 别名]
# 或者: from gameobject.GameObject import __init__ [as 别名]
	def __init__(self, root, x, y):
		GameObject.__init__(self, root, x, y)
		
		self.lifeAlarm = 0
		self.direction = 0

		self.sprite = load_image("sprites/projectiles/shots/0.png")
		self.rect = self.sprite.get_rect()
开发者ID:Indivicivet,项目名称:PyGG2,代码行数:10,代码来源:shot.py

示例4: __init__

# 需要导入模块: from gameobject import GameObject [as 别名]
# 或者: from gameobject.GameObject import __init__ [as 别名]
 def __init__(self, xy, name, type, variant=0, resources_left=1):
     GameObject.__init__(self, xy, type, solid=True, draw_once_seen=True)
     self.action = None
     self.view = make_rect(Pos(0,0), globals.SCREEN_SIZE)
     self.tile_variant = variant
     self.name = name
     self.resources_left = resources_left
     self.seen = False
开发者ID:ludamad,项目名称:7DayRL2013,代码行数:10,代码来源:resource.py

示例5: __init__

# 需要导入模块: from gameobject import GameObject [as 别名]
# 或者: from gameobject.GameObject import __init__ [as 别名]
 def __init__(self, game, position=(0, 0), angle=0, is_inside=True, radius=1, image='images/default.png', density=20,
              friction=8, name='Circle'):
     GameObject.__init__(self, game, position=position, angle=angle, is_inside=is_inside, image=image)
     size = self.surface.origin.get_size()
     self.name = name
     self.radius = ((size[0] + size[1]) / 4) / game.PPM
     self.body.CreateCircleFixture(radius=radius,
                                   density=density,
                                   friction=friction)
开发者ID:dregor,项目名称:game,代码行数:11,代码来源:personage_parts.py

示例6: __init__

# 需要导入模块: from gameobject import GameObject [as 别名]
# 或者: from gameobject.GameObject import __init__ [as 别名]
 def __init__(self):
     GameObject.__init__(self)
     self.orientation = -1   # 0 = horizontal, 1=vertical
     self.graphic = 0
     self.startPosition = [0,0]
     self.length = 0
     self.portalList = []
     self.wallExists = []
     self.exteriorWallID = -1
开发者ID:bisio,项目名称:hackenslash-bisio-edition,代码行数:11,代码来源:Room.py

示例7: __init__

# 需要导入模块: from gameobject import GameObject [as 别名]
# 或者: from gameobject.GameObject import __init__ [as 别名]
 def __init__(self, name=None, position=None, texImg=None, specTexImg=None, radius=None,
                    mass=None, spin=None, shininess=None, ka=None, kd=None,
                    ks=None, program=None):
     GameObject.__init__(self, name=name, position=position, texImg=texImg,
             specTexImg=specTexImg, shininess=shininess, ka=ka, kd=kd,
             ks=ks, program=program)
     self.radius = radius
     self.mass = mass
     self.spin = spin
     self._initModel()
开发者ID:bogdanteleaga,项目名称:TSBK07,代码行数:12,代码来源:planet.py

示例8: __init__

# 需要导入模块: from gameobject import GameObject [as 别名]
# 或者: from gameobject.GameObject import __init__ [as 别名]
	def __init__(self, name = None, min = [0,0,0], max = [5,5,5]):
		self.name = name

		self.min = min
		self.max = max
		
		self.type = "Box"
		
		self.pointselection = -1
		
		GameObject.__init__(self)
开发者ID:rameshvarun,项目名称:Azathoth,代码行数:13,代码来源:Box.py

示例9: __init__

# 需要导入模块: from gameobject import GameObject [as 别名]
# 或者: from gameobject.GameObject import __init__ [as 别名]
 def __init__(self, game, brain,  x, y):
     GameObject.__init__(self, game, x, y)
     game.creaturelist.append(self)
     self.size = 10
     self.score = 0
     self.direction = 0
     self.brain = brain
     self.lefteye = eye.Eye(self, game)
     self.righteye = eye.Eye(self, game)
     self.leftimage = []
     self.rightimage = []
开发者ID:Orpheon,项目名称:Dots-and-Circles-2,代码行数:13,代码来源:creature.py

示例10: __init__

# 需要导入模块: from gameobject import GameObject [as 别名]
# 或者: from gameobject.GameObject import __init__ [as 别名]
 def __init__(self):
     self.program = Program()
     self.vao = GLuint(0)
     self.vbuf = None
     self.ibuf = None
     self.vertices = []
     self.normals = []
     self.indices = []
     self.uvs = []
     # we should really be getting the camera not creating a new instance..
     self.camera = Camera(800, 600)
     GameObject.__init__(self)
开发者ID:davidejones,项目名称:spaceinvaders,代码行数:14,代码来源:mesh.py

示例11: __init__

# 需要导入模块: from gameobject import GameObject [as 别名]
# 或者: from gameobject.GameObject import __init__ [as 别名]
	def __init__(self, root, x, y):
		GameObject.__init__(self, root, x, y)

		self.owner = None
		self.firingSprite = None

		self.ammo = 0
		self.maxAmmo = 0
		self.justShot = False
		self.readyToShoot = True
		self.refireAlarm = 0

		self.direction = 0
开发者ID:Indivicivet,项目名称:PyGG2,代码行数:15,代码来源:weapons.py

示例12: __init__

# 需要导入模块: from gameobject import GameObject [as 别名]
# 或者: from gameobject.GameObject import __init__ [as 别名]
	def __init__(self, name = None, x = 1, y = 1, z = 1):
		self.name = name
		self.x = x
		self.y = y
		self.z = z
		
		self.type = "Point"
		
		self.pointselection = -1
		
		self.r = 1
		
		GameObject.__init__(self)
开发者ID:rameshvarun,项目名称:Azathoth,代码行数:15,代码来源:Point.py

示例13: __init__

# 需要导入模块: from gameobject import GameObject [as 别名]
# 或者: from gameobject.GameObject import __init__ [as 别名]
  def __init__(self, filename=None,  program=None, texImg=None, specTexImg=None,
               normalMap=None, shininess=None, ka=None, kd=None, ks=None):
        GameObject.__init__(self, name=None, position=None, texImg=texImg,
                            specTexImg=specTexImg, normalMap=normalMap,
                            shininess=shininess, ka=ka, kd=kd, ks=ks, 
                            program=program)
	self.variables = dict([(x,True)for x in ["hAngle", "vAngle", "right"]])
	self.oldhAngle = 0
	self.oldvAngle = 0
	self.zRotAngle = 0
	self.xRotAngle = 0
        self.vertices, self.normals, self.texCoords = loadObj(filename)

        self._initModel()
开发者ID:bogdanteleaga,项目名称:TSBK07,代码行数:16,代码来源:spaceship.py

示例14: __init__

# 需要导入模块: from gameobject import GameObject [as 别名]
# 或者: from gameobject.GameObject import __init__ [as 别名]
 def __init__(self, xy, item_type=None, pickup_description=None, on_pickup=None, dropped_this_turn=False):
     GameObject.__init__(self, xy, item_type.tile, solid=False, draw_once_seen=True)
     self.dropped_this_turn = dropped_this_turn
     self.item_type = item_type
     if item_type:
         if not pickup_description:
             self.pickup_description = (BABY_BLUE, "You pick up the ", WHITE, item_type.name, BABY_BLUE, ".")
         def on_pickup(player, _):
             player.add_item(item_type)
         self.on_pickup = on_pickup
     else:
         self.pickup_description = pickup_description
         self.on_pickup = on_pickup
         self.is_inv_item = False
开发者ID:ludamad,项目名称:7DayRL2013,代码行数:16,代码来源:items.py

示例15: __init__

# 需要导入模块: from gameobject import GameObject [as 别名]
# 或者: from gameobject.GameObject import __init__ [as 别名]
	def __init__(self, name = None, x = 1, y = 1, z = 1, r = 1):
		self.name = name
		self.x = x
		self.y = y
		self.z = z
		
		self.r = r
		
		self.reflectivity = 0.0
		
		self.type = "Sphere"
		
		self.pointselection = -1
		
		GameObject.__init__(self)
开发者ID:rameshvarun,项目名称:Azathoth,代码行数:17,代码来源:Sphere.py


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