View Single Post
  #10  
Old 02-27-2006, 11:54 AM
betancourtb82 betancourtb82 is offline
Member
 
Join Date: Jan 2006
Posts: 103
Here you go. Thanks

Code:
def shootBullet():
	global nextBullet
	#find the next available ball to shoot
	bullet = bullets[nextBullet]
	nextBullet = (nextBullet + 1) % NUM_BULLETS
	#Calculate the vector of the ball based on the mouse position
	bulletvector = viz.screentoworld(viz.mousepos()+[0])
	bullet.vector = viz.Vector(bulletvector[3]-bulletvector[0],bulletvector[4]-bulletvector[1],bulletvector[5]-bulletvector[2])
	bullet.vector.normalize()
	bullet.vector *= BULLET_SPEED
	
	#translate the bullet to the head position
	bullet.translate(viz.get(viz.HEAD_POS))
	
	#make the bullet and it's shadow visible
	bullet.visible(viz.ON)
	bullet.shadow.visible(viz.ON)
	
	#mark the bullet as active
	bullet.active = 1
Reply With Quote