Forum Discussion

TuomoNaskali's avatar
TuomoNaskali
Community Member
3 years ago

How to prevent character moving through maze walls?

Hi all!

I have a maze and a character that I move with buttons (up/down/left/right).

I have added triggers to prevent the character from moving through walls: When character intersects with wall, move character along a motion path away from the wall. But sometimes the character slips through the wall! Especially when I move the characted two times quickly. And some walls have walking paths on both sides of the wall, so I must include triggers to both directions in the wall (see attached picture), and then the character catches the motion path "through" the wall before backing up. Any ideas how to build this smart?

  • When I build something like this I created a grid (and map the x,y) and then mapped out which directions could be moved on each square and then built the logic to disable the buttons that could not be moved based on the x, y functions.

    To prevent clicking to quickly I would always disable the buttons when you press them and reenable them when the motion path animation completes.

  • I guess thats because of timing issues. I find it impressive you got this working with triggers at all. Storyline isnot build for this kind of interactivity im afraid. Timing issues will be tough to fix. 

    i would have used Javascript for something like this.

    A small trick that might help fix the issue when you have 2 paths at either side of a wall.... add the path that shouldnot be reachable to a SlideLayer and disable that layer untill some variable is set to true. That way you can't activate that untill that variable is true.

  • TuomoNaskali's avatar
    TuomoNaskali
    Community Member

    Thank you for the tips, Math and Phil!

    The easy solution was to prevent clicking too quickly, like Phil advised. It works well enough for this purpose, as long as I keep the character's motion paths short enough so they do not reach the other side of the wall.

    Would be nice to learn some JavaScript, though, and use it in Storyline!