Пример #1
0
	def update(self):
		self.image.fill((0x00,0x40,0x00))

		end_pos = (SIZE / 2 + SIZE / 2 * self.vect[0], SIZE / 2 - SIZE / 2 * self.vect[2])
		pygame.draw.line(self.image, (0x7F,0x7F,0x7F), (SIZE/2, SIZE/2), end_pos)
		self.vect = utils.rotateVectorY(self.vect, 15.0)

		x,y,z = utils.rotateVectorY((0.0, 0.0, 0.5), self.angle)
		self.angle = self.angle + 15.0
		if self.angle >= 360.0:
			self.angle = 0.0

		end_pos = (SIZE / 2 + SIZE / 2 * x, SIZE / 2 - SIZE / 2 * z)
		pygame.draw.line(self.image, (0xFF,0xFF,0xFF), (SIZE/2, SIZE/2), end_pos)
Пример #2
0
def move(amount, angle):
	global position, look_at
	# translation vector is final direction of movement
	translation_vect = rotateVectorY(direction, math.radians(-angle))
	position = (position[0] + translation_vect[0] * amount,
	            position[1] + translation_vect[1] * amount,
	            position[2] + translation_vect[2] * amount)
	look_at = addVectors(position, direction)
Пример #3
0
def rotate_horizontal(degrees):  # left/right
	global direction, look_at, yaw
	direction = rotateVectorY(direction, math.radians(-degrees))
	look_at = addVectors(position, direction)
	yaw += degrees  # temp hack!