Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Glenjamin on Fri 20/02/2015 20:15:13

Title: How do I keep the player from moving temporarily?
Post by: Glenjamin on Fri 20/02/2015 20:15:13
There's a part in my game where the character breaks his leg and needs an item to fix it. How can I make it so the player cannot move while it's leg is broken?
Title: Re: How do I keep the player from moving temporarily?
Post by: Gurok on Fri 20/02/2015 20:25:13
You could turn off the walkable area under the player:

RemoveWalkableArea(GetWalkableAreaAt(player.x - GetViewportX(), player.y - GetViewportY()));

And when he's ready to walk again, turn it back on (provided he's still in the same position):

RestoreWalkableArea(GetWalkableAreaAt(player.x - GetViewportX(), player.y - GetViewportY()));

If you have other characters that need to move around, you might want to make a special walkable area for the location where the character breaks his leg and turn that on/off. There are probably other ways to achieve this. This is just the most direct way I can think of.