"Line" as walls - TopDownMaze

Hello everyone, it’s me again! I’m asking for your help because I can’t figure out how to create this style of map (see image). My main problem is the walls on the lines between the squares. I’ve managed to represent them in my game by “reducing the size” of my sprites, but my collisions no longer work (I use a marker that I position in front of my character and I move by jumps of 16 pixels).

If I use “classic” moves, my character starts to bug if he goes between two walls :confused:

Does anyone have an idea how to make this work? Thank youu

You could cast a ray to the target position. I swapped out the point is inside with a ray cast using the same expressions. It seems to work the same.

The ray cast checks for a wall and the NOT still inverts it.

Since you already have the angle, you could cast the ray by angle.

Thank you for your reply. I am not sure I really get how the “Cast a ray” feature works… this is my code but my player get stucks without any wall in front of him

Are you using a separate object for collision? You would test only against that object or any unpassable objects.

Ray cast looks for the target object from a starting position using either a location or an angle/distance. If it finds an object between those points it picks the nearest object and triggers any events. The x, y intersection point is optional.

Since the condition is inside a NOT, it inverts it. So, if there’s not an object it will trigger the actions but if there is an object then it won’t.

Ray cast is also different because if you invert the condition (invert not use NOT) It picks the farthest object instead of the nearest.

1 Like