コード例 #1
0
	def move(self):
		old_pos = self.get_pos()
		width, height = self.screen.get_size()
		# print width, height, old_pos[0], old_pos[1]
		if old_pos[0]+self.radius > width and self.velx > 0:
			self.collide(0)
		if old_pos[0]-self.radius < 0 and self.velx < 0:
			self.collide(0)
		if old_pos[1]+self.radius > height and self.vely > 0:
			self.collide(90)
		if old_pos[1]-self.radius < 0 and self.vely < 0:
			self.collide(-90)

		new_pos = Physics.move(self)


		# print self.speed(), self.rect.left, self.rect.right, self.rect.top, self.rect.bottom, ((self.rect.right + self.rect.left)/2)/(old_pos[0]/5)
		self.rect.center=self.get_pos()
		
		self.screen.blit(self.character, self.rect)

		self.health = self.health - 0.01