示例#1
0
	def resetColor(self, color):
		self.arrAnim = []
		for i in range(0, self.nbFrames):
			if i + 1 < 10:
				self.arrAnim.append(Resources.loadPNG(self.imageName + "000" + str(i + 1) + ".png", True))
			elif i + 1 < 100:
				self.arrAnim.append(Resources.loadPNG(self.imageName + "00" + str(i + 1) + ".png", True))
			else:
				self.arrAnim.append(Resources.loadPNG(self.imageName + "0" + str(i + 1) + ".png", True))

		for img in self.arrAnim:
			img[0].fill(color, special_flags = BLEND_MULT)
示例#2
0
	def __init__(self, image, nbFrames):
		pygame.sprite.Sprite.__init__(self)

		self.flip = False
		self.interval = 0
		self.nbFrames = nbFrames
		self.play = True
		self.start = 0
		self.end = nbFrames - 1
		self.cyclic = True
		self.imageName = image

		self.arrAnim = []
		for i in range(0, self.nbFrames):
			if i + 1 < 10:
				self.arrAnim.append(Resources.loadPNG(self.imageName + "000" + str(i + 1) + ".png", True))
			elif i + 1 < 100:
				self.arrAnim.append(Resources.loadPNG(self.imageName + "00" + str(i + 1) + ".png", True))
			else:
				self.arrAnim.append(Resources.loadPNG(self.imageName + "0" + str(i + 1) + ".png", True))

		self.currentFrameNb = self.start
		self.image, self.rect = self.arrAnim[self.currentFrameNb]
示例#3
0
	def __init__(self, id = -1, x = 0, y = 0, type = "earth"):
		self.typeList = {"earth":"earth.png", "ice":"ice.png", "carrot":"carrot.png", "boing":"boing.png"}

		self.id = id
		self.posX = x
		self.posY = y
		self.type = type

		self.friction = 0.7

		if self.type == "ice":
			self.friction == 0.2

		if self.type == "empty":
			self.rect = pygame.Rect(0, 0, 0, 0)
		else:
			pygame.sprite.Sprite.__init__(self)
			self.image, self.rect = Resources.loadPNG(self.typeList[self.type])

		self.rect.topleft = (self.posX, self.posY)
示例#4
0
	def replaceImage(self, objType, isFloor = False):
		if isFloor or self.type == "boing":
			self.image = Resources.loadPNG(self.typeList[objType])[0]
		else:
			self.image = Resources.loadPNG("middle_" + self.typeList[objType])[0]