Chow to beat chain of command

my code

hero.moveXY(30, 33)
def onHear(event):
    if event.speaker == hero:
        pet.say('wake up lazy')
while True:
    enemy = hero.findNearestEnemy()
    if enemy:
        hero.say("WAKE HIM UP")
        hero.moveXY(30, 15)


what happend

Where’s the event handler? It’s usually a good idea to keep the comments, since they tend to guide and help:

# Assign the event handler for "hear" event.
1 Like