當前位置: 首頁>>代碼示例>>Python>>正文


Python gameobject.GameObject類代碼示例

本文整理匯總了Python中gameobject.GameObject的典型用法代碼示例。如果您正苦於以下問題:Python GameObject類的具體用法?Python GameObject怎麽用?Python GameObject使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了GameObject類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_eq

 def test_eq(self):
     a = GameObject()
     a.pos_x = 100
     b = GameObject()
     b.pos_x = 100
     self.assertTrue(a == b)
     pass
開發者ID:ryutaroikeda,項目名稱:triplepong,代碼行數:7,代碼來源:gameobject_test.py

示例2: __init__

 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,代碼行數:26,代碼來源:player.py

示例3: __init__

 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,代碼行數:7,代碼來源:enemies.py

示例4: __init__

	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,代碼行數:8,代碼來源:shot.py

示例5: __init__

 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,代碼行數:8,代碼來源:resource.py

示例6: __init__

 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,代碼行數:9,代碼來源:personage_parts.py

示例7: __init__

 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,代碼行數:9,代碼來源:Room.py

示例8: draw

 def draw(self):
     if self.game.debug:
         for i in range(len(self.body.fixtures)):
             pt = self._place(i)
             pygame.draw.circle(self.game.screen, (20, 20, 20), self.game.to_screen(pt),
                                int(10 * self.game.camera.zoom), 1)
             pt = self._place(i, False)
             pygame.draw.circle(self.game.screen, (20, 20, 20), self.game.to_screen(pt),
                                int(10 * self.game.camera.zoom), 1)
     GameObject.draw(self)
開發者ID:dregor,項目名稱:game,代碼行數:10,代碼來源:maw.py

示例9: __init__

 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,代碼行數:10,代碼來源:planet.py

示例10: __init__

 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,代碼行數:11,代碼來源:creature.py

示例11: __init__

	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,代碼行數:11,代碼來源:Box.py

示例12: __init__

 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,代碼行數:12,代碼來源:mesh.py

示例13: __init__

	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,代碼行數:13,代碼來源:weapons.py

示例14: __init__

	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,代碼行數:13,代碼來源:Point.py

示例15: draw

	def draw(self):
		mouse_x, mouse_y = pygame.mouse.get_pos()

		if point_direction(self.x, self.y, mouse_x + self.root.Xview, mouse_y + self.root.Yview) > 90 and point_direction(self.x, self.y, mouse_x + self.root.Xview, mouse_y + self.root.Yview) < 270:
			if self.flip == 0:
				self.sprite = pygame.transform.flip(self.sprite, 1, 0)
				self.flip = 1
		else:
			if self.flip:
				self.sprite = pygame.transform.flip(self.sprite, 1, 0)
				self.flip = 0

		GameObject.draw(self)
開發者ID:Indivicivet,項目名稱:PyGG2,代碼行數:13,代碼來源:character.py


注:本文中的gameobject.GameObject類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。