Пример #1
0
	def update(self):
		self.direction += self.turning*Settings.turning_speed

		self.image = self.spaceship.copy()
		if self.accel:
			self.move[0] += math.sin(math.radians(-self.direction))*Settings.spaceship_accel
			self.move[1] += -math.cos(math.radians(self.direction))*Settings.spaceship_accel
			#show flames
			self.image.blit(self.flame[self.flameCounter], self.flameRect)
			self.flameCounter = (self.flameCounter+1)%3
			vol_r = abs(self.pos[0]/Settings.screen_size[0])
			if vol_r > 1:
				vol_r = 1
			vol_l = 1-vol_r

			if self.snd_engine_channel:
				self.snd_engine_channel.set_volume(vol_l, vol_r)
		
		#rotate image
	
		self.image = pygame.transform.rotate(self.image, self.direction)
		#create new rect, which will center itself properly
		self.rect = self.image.get_rect()
		self.rect.center = self.pos

		FlyingObject.update(self)
Пример #2
0
	def update(self):
		FlyingObject.update(self)
		self.lifespan -= 1
		if self.lifespan <= 0:
			self.kill()