Limiting the terrain that an actor can walk on

I’m not sure creating collision walls around the path is your best solution here. That looks like it would take quite a lot of collision geometry.

I actually really like your idea of checking the color of an image at a given coordinate to determine if it’s on the path or off of it.

Looking at the little bit of code you provided, I’m seeing two things that make me curious.

First, you’re loading the image into self.redline. Then you’re getting the green value from something called cm, right? What is cm? Don’t you want the green value from self.redline?

Secondly, I see that you’re inputting the actor’s coordinates directly. Do the coordinates of the space your actor is in perfectly match the coordinates for the image? That seems unlikely, you probably need to convert the coordinates with a formula, even if it’s just up or downscaling. I haven’t messed with PNMImage much, so I don’t know how it describes the coordinates of the image, but I’m guessing it’s probably between 0 and 1, or maybe between 0 and [image dimension in pixels].