当前位置: 首页>>代码示例>>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;未经允许,请勿转载。