Are functors supposed to work?

I’m new to code combat (but not development) and am wondering if the following code should work.

def handleEnemy(enemy):
     #enemy handling code

def patrolTo (start, stop, maxStep, onEnemy):
        e = self.findNearestEnemy()
        if e:
            if not onEnemy(e):
        # continue patrol

# ...


My expectation is that handleEnemy should be invoked when an enemy is found, but instead I get the error “object is not a function”.

I also would like to see some real python tag inside the game instead a bunsh of loops , i also suggest to make self.say as print , self.say is more suitable for a game but c’mon we’re here to learn computer language

@Yaur : use the level editor and make a lvl that teach you how to use functions

We’ll be working to improve support and error messages for player-defined functions soon, but it will help if you post your entire code as a GitHub issue so we can try to reproduce: