Code never finished infinite loop issue - (Doom Glade)


#1

I’ve actually had this issue on the past two levels as well and I’m really not sure what was causing it.
Basically when I run my code, as soon as Nalfar enters battle the whole stage freezes and I end up getting this error:

If I go back to the map and come back in, the game tells me it’s stuck in a loop and asks if I would like it to comment out my code and when I say yes, it adds this top line:

waterfox_2018-06-13_08-39-36

Any help would be greatly appreciated.


#2

Try deleting the devour part.


#3

I tried removing devour (and drain-life), but the problem persisted. After adding

else:
    hero.attack(enemy)

after the drain life, (or using hero.say when the hammer is equipped) the problem ceases entirely. I’m still trying to understand it, but I think the problem had to do with the fact that the loop keeps running but can’t actually find anything to do and so somehow causes everything else to freeze.

Is someone with more programming experience than I able to explain the specifics of what caused the problem? Just so that I can understand it properly.


#4

you don’t need that last elif. drain-life does not have a cool down, and delete the return.