What is the mistake? Why does "diecontrol" put on the outside of judgment report this error? It doesn't exist in it!

--------------------------------Code-----------------------------------

if self.botime <= 0:
      enemy.actor.play("die")
      self.botime = random.uniform(0.5, 0.7)
dieControl = enemy.actor.getAnimControl("die")
if dieControl is None or not dieControl.isPlaying():
      enemy.actor.cleanup()

---------------------------------mistake------------------------------

 File "C:\Panda3D-1.10.4.1-x64\direct\showbase\ShowBase.py", line 3124, in run
    self.taskMgr.run()
  File "C:\Panda3D-1.10.4.1-x64\direct\task\Task.py", line 531, in run
    self.step()
  File "C:\Panda3D-1.10.4.1-x64\direct\task\Task.py", line 485, in step
    self.mgr.poll()
  File "C:/Users/codemao/Desktop/Rescue_big_adventure/Game7-9.py", line 152, in update
    dieControl = enemy.actor.getAnimControl("die")
  File "C:\Panda3D-1.10.4.1-x64\direct\actor\Actor.py", line 1710, in getAnimControl
    assert partDict != None
AssertionError

Ah, I wonder whether this isn’t connected to your other issue of the death-animations remaining on the first frame: I suspect that the enemy’s actor is being cleaned up–and then the above logic is run for it again (possibly as a result of being detected as being “dead” more than once, and thus being in the relevant list more than once). As a result, the “getAnimControl” method is being run on an actor that has been cleaned up, and that therefore doesn’t have animation data.

Ah, I tested it. That’s exactly why. Thank you very much.

1 Like