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


Python Scene.sprites方法代码示例

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


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

示例1: main

# 需要导入模块: from scene import Scene [as 别名]
# 或者: from scene.Scene import sprites [as 别名]
def main():
	import scene
	from scene import Scene
	game = Scene()
	grassBackground = Grass()
	game.sprites = [grassBackground]
	game.start()
开发者ID:townsean,项目名称:Buford,代码行数:9,代码来源:Grass.py

示例2: __animateUp

# 需要导入模块: from scene import Scene [as 别名]
# 或者: from scene.Scene import sprites [as 别名]
	def __animateUp(self):
		#print("ANIMATING UP")
		print("CurrentIndex: ", self.currentFrameIndex, " TotalFrames:  ", len( self.frames ) )
		if (self.currentFrameIndex < len( self.frames ) - 1 ):
			self.currentFrameIndex += 1
			print("New Index", self.currentFrameIndex)
	
	def __animateDown(self):
		#print("ANIMATING DOwn")
		if (self.currentFrameIndex > 0 ):
			self.currentFrameIndex -=1
			
	def __updateAnimationState(self):
		#print("UPDATE ANIMATION STATE")
		if( self.currentFrameIndex == 0 ):
			self.status = self.INACTIVE
		elif( self.currentFrameIndex >= len( self.frames )-1 ):
			self.status = self.GOING_DOWN

if __name__ == "__main__":
	import scene 
	from scene import Scene
	from Girl import Girl
	game = Scene()
	buford = Buford()
	buford.setImage("buford.gif")
	girl = Girl()
	girl.setImage("girl.png");
	game.sprites = [buford, girl]
	game.start()
开发者ID:townsean,项目名称:Buford,代码行数:32,代码来源:Buford.py

示例3: print

# 需要导入模块: from scene import Scene [as 别名]
# 或者: from scene.Scene import sprites [as 别名]
		""" boolean function. Returns True if the mouse is 
			clicked over the sprite, False otherwise
		"""
		self.pressed = False
		if pygame.mouse.get_pressed() == (1, 0, 0):
			if self.rect.collidepoint(pygame.mouse.get_pos()):
				print("MOUSE DOWN")
				self.pressed = True
		return self.pressed

	def clicked(self):
		""" Boolean function. Returns True only if mouse
			is pressed and released over sprite
		"""
		released = False
		if self.pressed:
			if pygame.mouse.get_pressed() == (0, 0, 0):
				if self.rect.collidepoint(pygame.mouse.get_pos()):
					print("CLICKED!")
					released = True
			return released

if __name__ == "__main__":
	import scene 
	from scene import Scene
	game = Scene()
	girl = Girl()
	game.sprites = [girl]
	girl.setImage("girl.png")
	game.start()
开发者ID:townsean,项目名称:Buford,代码行数:32,代码来源:Girl.py

示例4: __updateAnimationState

# 需要导入模块: from scene import Scene [as 别名]
# 或者: from scene.Scene import sprites [as 别名]
			
	def __updateAnimationState(self):
		#print("UPDATE ANIMATION STATE")
		if( self.currentFrameIndex == 0 ):
			self.status = self.INACTIVE
		elif( self.currentFrameIndex >= len( self.frames )-1 ):
			self.status = self.GOING_DOWN

	def popUp(self):
		print ("POP UP")
		self.status = self.GOING_UP
	
	def popDown(self):
		print ("POP DOWN")
		self.status = self.GOING_DOWN

if __name__ == "__main__":
	import scene 
	from scene import Scene
	from Girl import Girl
	from Buford import Buford
	game = Scene()
	buford = Buford()
	buford.setImage("buford.gif")
	girl = Girl()
	girl.setImage("girl.png")
	chasingNeeb = ChasingNeeb()
	chasingNeeb.setImage("neeb_still.gif")
	game.sprites = [buford, girl, chasingNeeb]
	game.start()
开发者ID:townsean,项目名称:Buford,代码行数:32,代码来源:ChasingNeeb.py

示例5: print

# 需要导入模块: from scene import Scene [as 别名]
# 或者: from scene.Scene import sprites [as 别名]
			self.neebSprites_[x].x = 0 + change
			self.neebSprites_[x].y = 0
			change += 10
			
		self.neebGroup_ = pygame.sprite.Group( self.neebSprites_ )
		print("DONE")
		
			
	def checkCollision(self):
		print("COLLIISION")
		print("AGAIN")
		for neeb in self.neebSprites_:
			collidedNeeb = pygame.sprite.spritecollideany(neeb, self.neebGroup_)
			if collidedNeeb is not None:
				
				neeb.x += collidedNeeb.width
				neeb.y += collidedNeeb.height
				print("New Neeb Location (", neeb.x,",", neeb.y,")" )
		
if __name__ == "__main__":
	import scene 
	from scene import Scene

	game = Scene()
	neebs = NeebDepot()
	neebs.generateSprites(5)
	game.sprites = [ neebs.neebSprites() ]
	for x in range(5):
		neebs.checkCollision()
	game.start()
	
开发者ID:townsean,项目名称:Buford,代码行数:32,代码来源:NeebDepot.py


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