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


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


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

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