Did I find the right examples for you? yes no

All Samples(12)  |  Call(12)  |  Derive(0)  |  Import(0)

        def loadImage(imageFile, colorKey=None):
	path = os.path.join(GAME_IMAGES, imageFile)
	path = filepath(path)
	try:
		image = pygame.image.load(path)
	except pygame.error, message:
		print "Error loading image:", imageFile
		raise SystemExit, message
	
	# convert for speed and grab rect for collisions
	image = image.convert_alpha()
	rect = image.get_rect()
	
	# handle colorKey
	if colorKey is not None:
		if colorKey is -1:
			colorKey = image.get_at((0,0))
		image.set_colorkey(colorKey, RLEACCEL)

	return image, rect
        


src/h/a/HackathonF2011-HEAD/src/Player.py   HackathonF2011(Download)
		# up, down, left, right
		self.images = [0] * 4
		self.images[0], self.rect = util.loadImage(PLAYER_IDLE_UP, -1)
		self.images[1], self.rect = util.loadImage(PLAYER_IDLE_DOWN, -1)
		self.images[2], self.rect = util.loadImage(PLAYER_IDLE_LEFT, -1)
		self.images[3], self.rect = util.loadImage(PLAYER_IDLE_RIGHT, -1)
		# load sword
		self.swordLeft        = pygame.sprite.Sprite()
		self.swordLeft.image,self.swordLeft.rect  = util.loadImage("swordSwingLeft.png")
		self.swordUp          = pygame.sprite.Sprite()
		self.swordUp.image,self.swordUp.rect    = util.loadImage("swordSwingUp.png")

src/h/a/HackathonF2011-HEAD/src/Actor.py   HackathonF2011(Download)
	def loadImage(self, imageFile, colorKey=None):
		self.image, self.rect = util.loadImage(imageFile, colorKey)
 
	def setImage(self, newImage):
		self.image = newImage

src/h/a/HackathonF2011-HEAD/src/TerrainLayer.py   HackathonF2011(Download)
		for x in imagekeys:
			#load the image and key it the same
			temp,tmp = util.loadImage(thismap.aliases[x])
			temptile = pygame.Surface((TILEX,TILEY))
			temptile.blit(temp, tmp)
				if not thismap.atLayer[y][x] == '.':
					sprite = pygame.sprite.Sprite(self.atGroup)
					sprite.image, sprite.rect = util.loadImage(thismap.aliases[thismap.atLayer[y][x]])
					sprite.rect.topleft = ((x+2)*TILEX, y*TILEY)
 

src/h/a/HackathonF2011-HEAD/src/Magic.py   HackathonF2011(Download)
        def __init__(self, x, y):
            super(Magic,self).__init__()
 
            if Magic.loadedImage == 0:
                Magic.loadedImage,tmp = util.loadImage(MAGIC_ATTACK_IMAGE)