Jan-20-2020, 05:00 PM
I think the route to take is certainly with a tile-map. You can use a program like "Tiled" to draw it, or more simply if you prefer, use a .txt file where each character represents a square, and each square can be open floor or a sprite. The AI sprite can easily be made not to pass through wall sprites.
I don't know how to convert that specific image into a working map, but you can replicate and change it as a text file with great ease.
What kind of image file is it? It would seem possible to use map itself as a pygame sprite's image, and use a mask and pixel-perfect collision. If you want or need to use that image, that's the only way I can think of. In the end is amounts to "color detection", just a strange approach. I'm probably over complicating things. It's a habit. lol
But in the end, tilemaps are a very standard way of making a map for something to walk around in.
I don't know how to convert that specific image into a working map, but you can replicate and change it as a text file with great ease.
What kind of image file is it? It would seem possible to use map itself as a pygame sprite's image, and use a mask and pixel-perfect collision. If you want or need to use that image, that's the only way I can think of. In the end is amounts to "color detection", just a strange approach. I'm probably over complicating things. It's a habit. lol
But in the end, tilemaps are a very standard way of making a map for something to walk around in.