• 2D
  • How to make a bear trap thing

How to make a thing (like a bear trap) when someone step in they can't move, if they press a button then they can go

Create a bool true/false variable(lets call it stuck) in your character controller. Make the movement code check the state of that variable, if stuck = true then skip moving the character. If the player does the interaction necessary to become unstuck then flip the value of the stuck variable again and have a timer blocking it from getting immediately triggered again by the trap.

Alternatively the variable can be on the trap as it's state, so that when it gets disabled the trap wont keep you stuck anymore.

@Megalomaniak thanks it worked :D