WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #5  
Old 05-18-2006, 12:49 PM
betancourtb82 betancourtb82 is offline
Member
 
Join Date: Jan 2006
Posts: 103
Ok, I did the box tactic, however now i'm not sure how to reference the boxes. When an avatar gets hit I say "if info.object in characters (the character array of avatars). How Can I do this with the boxes?

Also, I had another question regarding avatar hits. I'm having a problem that when a bullet hits the avatar, the avatar is still able to be hit, thus incrementing the hit count. I want the avatar hit count to only be incremented once for every avatar that gets hit. It is not important to know whether an avatar gets hit multiple times. I added a info.object.disable(viz.COLLISION) to disable collisions as soon as they get hit.

Code:
 info = viz.intersect(pos,futurePos)
 if info.intersected:
  if info.object in characters:
   info.object.disable(viz.COLLISION)
   #print "in characters"
   if info.object.tag == 0:
    soldierCount += 1
    if info.object.threatening == TRUE:
     threatCount += 1
    elif info.threatening == FALSE:
     nonthreatCount += 1
   elif info.object.tag == 1:
    maleCount += 1
    if info.object.threatening == TRUE:
     threatCount += 1
    elif info.object.threatening == FALSE:
     nonthreatCount += 1
   elif info.object.tag == 2:
    femaleCount += 1
    if info.object.threatening == TRUE:
     threatCount += 1
    elif info.object.threatening == FALSE:
     nonthreatCount += 1
   avatarsHit = avatarsHit + 1
   viz.playsound('arrgh.wav')
   WaitThenFreeze = vizact.sequence( vizact.waittime(info.object.getduration(7)-.85), vizact.speed_node(0) )
   info.object.execute(7)
   info.object.clear(viz.ALL)
   info.object.clear(viz.CURRENT_ACTION)
   info.object.add(WaitThenFreeze) #Add the action to the avatar
   RemoveAvatarAction = vizact.call(RemoveAvatar,info.object)
   info.object.add(RemoveAvatarAction) #Add action to remove avatar
This solves the problem of the multiple hits, however I don't know where to enable the collision again for the next time they walk out. I have two functions that are called (RemoveAvatar and RestoreAvatar). Would I be able to put insert an enable(viz.COLLISION) anywhere in these two functions. I hope this is making sense.

Code:
def RemoveAvatar(avatar):
 global avatarCount
 avatar.visible(0) #Hide avatar
 avatar.speed(1) #Restore speed
 characters.remove(avatar) #Remove from list
 dead_list.append(avatar) #Add to dead list
 avatarCount += 1
 print 'avatar count is: ', avatarCount
def RestoreAvatar():
 global keyindex
 if len(dead_list):
  print "avatar restored"
  avatar = dead_list.pop() #Ressurrect dead avatar
  avatar.visible(1) #Make it visible
  characters.append(avatar) #Add it to avatar list

Last edited by betancourtb82; 05-18-2006 at 02:43 PM.
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 04:54 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2026, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC