Collisions with the walls of the maze.

Hi!
Give me an idea, please.
How to realize the collision of the player with the walls of the maze?

For example, here’s a simple maze:
image

It is unclear how to make Defold realize that a player cannot cross walls.

There was an idea: track the color of the pixels below the player and keep out black pixels, for example. But I haven’t found an API to get the Sprite pixel color.

try to think that what you draw is just a visual representation of the simulation you are doing.
so in your specific case, you may have a data structure in memory (a 2x2 matrix probably) describing each cell.
when the player needs to move, you will have to retrieve the current player’s cell, the destination one, and decide if movement is possible.
having the game logic tightly coupled to the presentation is bad because tomorrow you might want to change the presentation (for example the background is no longer black but an image of a galaxy) and your logic would break

4 Likes