Thread: Object.remove()
View Single Post
  #26  
Old 03-01-2006, 01:16 PM
betancourtb82 betancourtb82 is offline
Member
 
Join Date: Jan 2006
Posts: 103
The code to remove is here:

Code:
def onmousedown(button):
	global index
	if button == viz.MOUSEBUTTON_LEFT:
		node = viz.pick() #Get object that was clicked
		if node in avatars: #Check if object is one of the avatars
			node.clear(viz.ALL)
			node.clear(viz.CURRENT_ACTION)
			node.execute(7) #Execute the "shot" animation
			#Create action to wait for the animation duration then freeeze the avatar
			WaitThenFreeze = vizact.sequence( vizact.waittime(node.getduration(7)-.14), vizact.speed_node(0))
			#vizact.sequence(vizact.waittime(2),avatars.remove(male),1)			
			node.add(WaitThenFreeze) #Add the action to the avatar
			node.clear(viz.ALL)
			node.clear(viz.CURRENT_ACTION)
			node.add(vizact.waittime(1))
			node.add(vizact.call(node.remove))
		index = index - 1
		if index == 0 :
				print 'new index is',index
				for i in range(NUM_AVATARS):
					newX = -math.cos(-2*i+15) * 2
					newZ = math.sin(i^2+1) * 2	
					male = viz.add('male.cfg')
					#male.face(facepic)
					male.translate(newX,-10,newZ)
					male.rotate(90,-10,0)
					#we might be able to use this type of declaration when we need to decide who is safe to shoot and who isn't
					male.SafeIndicator = 1						
					avatars.append(male) #Save avatar in list
					print "avatar indicator is", male.SafeIndicator	
viz.callback(viz.MOUSEDOWN_EVENT,onmousedown)
Reply With Quote