當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。