How do I make my chasing wall perfectly cover the path behind it?

Not favoritedFavorited Favorited 0 favourites
  • 4 posts
From the Asset Store
Wall Pin Board is a hyper causal game developed for fun and inspired by YouTube video whose link is given in description
  • Hi everyone!

    I’m currently trying to make a “chasing wall” system — something like a wall that automatically moves along a path and closes the way behind it.

    Here’s how I’m doing it so far:

    I use Pathfinding behavior to make a sprite move automatically from the start point to the finish point.

    While it moves, it spawns wall pieces (small sprites) along the path to make it look like the road is being closed behind it.

    It works, but honestly it feels quite messy and far from perfect 🤣🤣 . Some parts of the path are still not fully covered, and sometimes when the wall passes near corners or dialog areas, it doesn’t close the path smoothly.

    I’ve attached my project file and a screenshot of my event sheet so you can see what I mean.

    c3p file : drive.google.com/file/d/16NDbN4xJ72KFA0kQDrP_V9sN-v2J7ZHq/view

    👉 I’d like to ask if there’s a better or more efficient way to make the chasing wall cover everything perfectly as it moves along the path — or if anyone has another method for this kind of effect.

    Thanks a lot for any help or suggestions!

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Your example seems to flicker badly after a while. I guess c3 updates are obsoleting my hardware.

    Anyways, you could possibly use a floodfill algorithm to fill the empty cells. Basically mark the start cell, then fill it and mark the empty neighboring cells, and repeat. To make it smoother you could use a sprite animation instead of filling a cell right away. Or if you keep track of the edge cells you could position some sprites around there.

    Just an idea.

  • Here's a test of the idea. I used a higher resolution tilemap to make the water motion jump in smaller steps. I also made it so cells can have higher priority so it fills falling the shape of the corridor more or less.

    dropbox.com/scl/fi/g9pu4fcr9qdkmo7weqjbw/flooding_idea.capx

    Again you probably could make the motion smoother by gradually moving the flood sprites from one spot to another and running the flood function once they stop at the destination.

    One thing I'm not super happy with is we have to call the function from separate events instead of under a repeat condition. That's do to a quirk with picking and newly created objects.

    A smoother and more complex idea still could be to trace the polyline that makes up the corridor and then starting with the point where the water starts from move two points to the left and right along the polyline. That would basically give us a fill line. Probably could come up with some kind of logic to decide how far each edge point should move to add a certain amount of water per frame. I'd imagine you could borrow some ideas from a triangulation algorithm like "ear clipping." Anyways, that's just a general idea, I'd imagine it may end up being simpler to do than you think but I'm not sure.

  • Oh wow, thanks so much for the example!

    I’ll try it out and see if I can tweak it to get the result I’m looking for.

    Really appreciate the help R0J0hound

Jump to:
Active Users
There are 0 visitors browsing this topic (0 users and 0 guests)